Stefan Krah added the comment: Martin v. L??wis <rep...@bugs.python.org> 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 <rep...@bugs.python.org> <http://bugs.python.org/issue15622> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com