A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-November/114467.html below:

[Python-Dev] Hashable memoryviews

[Python-Dev] Hashable memoryviewsNick Coghlan ncoghlan at gmail.com
Sun Nov 13 11:54:22 CET 2011
On Sun, Nov 13, 2011 at 8:39 PM, Stefan Krah <stefan at bytereef.org> wrote:
> Antoine Pitrou <solipsis at pitrou.net> wrote:
>> Only if the original object is itself mutable, otherwise the memoryview
>> is read-only.
>>
>> I would propose the following algorithm:
>> 1) try to calculate the original object's hash; if it fails, consider
>>    the memoryview unhashable (the buffer is probably mutable)
>
> With slices or the new casts (See: http://bugs.python.org/issue5231,
> implemented in http://hg.python.org/features/pep-3118#memoryview ),
> it is possible to have different hashes for equal objects:

Note that Antoine isn't suggesting that the underlying hash be *used*
as the memoryview's hash (that would be calculated according to the
same rules as the equality comparison). Instead, the ability to hash
the underlying object would just gate whether or not you could hash
the memoryview at all.

Cheers,
Nick.


-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4