This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author loewis
Recipients Arfrever, christian.heimes, georg.brandl, loewis, mark.dickinson, meador.inge, ncoghlan, pitrou, python-dev, skrah, vstinner
Date 2012-08-11.20:28:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <5026C062.9050206@v.loewis.de>
In-reply-to <1344715010.3350.15.camel@localhost.localdomain>
Content
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.
History
Date User Action Args
2012-08-11 20:28:23loewissetrecipients: + loewis, georg.brandl, mark.dickinson, ncoghlan, pitrou, vstinner, christian.heimes, Arfrever, skrah, meador.inge, python-dev
2012-08-11 20:28:22loewislinkissue15573 messages
2012-08-11 20:28:22loewiscreate