Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment:

The lack of support for the rich comparison operators on even the most basic 
memoryviews (e.g. 'B' format) means that memoryview is still a regression from 
some of the functionality buffer offered back in Python 2 ( 
https://stackoverflow.com/a/13574862/364696 ); you either need to convert back 
to bytes (losing the zero-copy behavior) or hand-write a comparator of your own 
to allow short-circuiting (which thanks to sort not taking cmp functions 
anymore, means you need to write it, then wrap it with functools.cmp_to_key if 
you're sorting, not just comparing individual items).

While I'll acknowledge it gets ugly to try to support every conceivable format, 
it seems like, at the very least, we could provide the same functionality as 
buffer for 1D contiguous memoryviews in the 'B' and 'c' formats (both of which 
should be handleable by a simple memcmp).

----------
nosy: +josh.r

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue20399>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to