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

Not my use case specifically, but my link in the last post (repeated below) was 
to a StackOverflow answer to a problem where using buffer was simple and fast, 
but memoryview required annoying workarounds. Admittedly, in most cases it's 
people wanting to do this with strings, so in Python 3 it only actually works 
if you convert to bytes first (possibly wrapped in a memoryview cast to a 
larger width if you need to support ordinals outside the latin-1 range). But it 
seems a valid use case.

Examples where rich comparisons were needed include:

Effcient way to find longest duplicate string for Python (From Programming 
Pearls) - https://stackoverflow.com/a/13574862/364696 (which provides a 
side-by-side comparison of code using buffer and memoryview, and memoryview 
lost, badly)

strcmp for python or how to sort substrings efficiently (without copy) when 
building a suffix array - https://stackoverflow.com/q/2282579/364696 (a case 
where they needed to sort based on potentially huge suffixes of huge strings, 
and didn't want to end up copying all of them)

----------

_______________________________________
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