Message168006
Am 11.08.12 21:59, schrieb Antoine Pitrou:
> Le samedi 11 août 2012 à 19:52 +0000, Nick Coghlan a écrit :
>> I'd be happier if the compare-by-value didn't make complete copies of
>> the entire array though.
>
> Ditto. If a and b are bytes objects, comparing memoryview(a) and
> memoryview(b) should be as cheap as comparing a and b.
I agree with Antoine's requirement, generalizing it to "the simple
cases should be efficient". I wonder why the procedure couldn't instead
be
1. compare shapes
2. if the format strings are string-equal, compare the
memory representation
3. else unpack values
Then, comparing two 1D 'B' memoryviews would be a memcmp
(i.e. it wouldn't do compare-by-value in this case).
For unpacking, I don't see any way to have it efficient
and still maintainable, since mixed-type comparisons
are quite tedious to write in C, and really best done with
type normalization and multiple dispatch in the way that
unpacking will do it. |
|
Date |
User |
Action |
Args |
2012-08-11 20:28:23 | loewis | set | recipients:
+ loewis, georg.brandl, mark.dickinson, ncoghlan, pitrou, vstinner, christian.heimes, Arfrever, skrah, meador.inge, python-dev |
2012-08-11 20:28:22 | loewis | link | issue15573 messages |
2012-08-11 20:28:22 | loewis | create | |
|