Stefan Krah added the comment: Martin v. Loewis <rep...@bugs.python.org> wrote: > I would be fine with deprecating the 'u' type arrays, acknowledging > that the Py_UNICODE element type is even more useless now than before. > If that is done, there is no point in fixing anything about it. If > it exports using the 'u' and 'w' codes - fine. If then memoryview > doesn't work properly - fine; this is a deprecated feature.
>From the perspective of memoryview backwards compatibility, deprecation is >fine. In 3.2, memoryview could really only handle one-dimensional buffers of unsigned bytes: >>> import array >>> a = array.array('u', "ABC") >>> x = memoryview(a) >>> a[0] == x[0] False >>> a[0] 'A' # Indexing returns bytes instead of str: >>> x[0] b'A\x00' >>> # Index assignment attempts to do slice assignment: >>> x[0] = 'Z' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'str' does not support the buffer interface >>> I'm +1 for deprecating 'u' and 'w' in the array module, accept that memoryview cannot handle 'u' and 'w' and fix the situation properly in 3.4. I agree that the latter would require people to come up with actual use cases. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15625> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com