Python 3.3 can't sort memoryviews as they're unorderable

M

Mark Lawrence

http://docs.python.org/dev/whatsnew/3.3.html states "memoryview
comparisons now use the logical structure of the operands and compare
all array elements by value". So I'd have thought that you should be
able to compare them and hence sort them, but this is the state of play.

Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: memoryview() < memoryview()

Okay then, let's subclass memoryview to provide the functionality.
.... pass
....
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: type 'memoryview' is not an acceptable base type

Oh dear.
http://docs.python.org/py3k/library/stdtypes.html#typememoryview only
gives examples of equality comparisons and there was nothing that I
could see in PEP3118 to explain the rationale behind the lack of other
comparisons. What have I missed?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top