report at bugs
Aug 11, 2012, 2:44 AM
Post #3 of 13
Stefan Krah added the comment:
[issue15622] struct module 'c' specifier does not follow PEP-3118
[In reply to]
Martin v. L??wis <report [at] bugs> wrote:
> It's unfortunate that PEP 3118 deviates from the struct module, however,
> memoryview is based onthe buffer interface,and its formatcodes ought to
> conform to the PEP, not to the struct module (IMO).
The struct module itself should conform to PEP-3118, see #3132.
I think the struct module should be updated first. The proliferation of
subtly different format codes is not manageable. For example, if you use
NumPy, there are already differences between NumPy syntax and struct syntax.
Also, one should always be able to unpack the tobytes() representation
using the struct module and get the same result as from flatten(tolist()).
> It's easy to see that it *doesn't* follow the struct syntax, as it is
> possjible to create memoryview objects with other format codes in 3.3.
memoryview has *always* allowed arbitrary format strings during construction.
In 3.3, it keeps this property for backwards compatibility.
It does follow struct syntax whenever it *uses* one of the format codes,
like in tolist().
title: memoryview.to_list() incorrect for 'c' format -> struct module 'c' specifier does not follow PEP-3118
Python tracker <report [at] bugs>
Python-bugs-list mailing list