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/114463.html below:

[Python-Dev] Hashable memoryviews

[Python-Dev] Hashable memoryviews [Python-Dev] Hashable memoryviewsAntoine Pitrou solipsis at pitrou.net
Sun Nov 13 02:38:22 CET 2011
Thinking of it, an alternative would be to implement lazy slices of
bytes objects (Twisted uses buffer() for zero-copy slices).

Regards

Antoine.


On Sun, 13 Nov 2011 01:23:59 +0100
Antoine Pitrou <solipsis at pitrou.net> wrote:
> 
> Hello everyone and Benjamin,
> 
> Currently, memoryview objects are unhashable:
> 
> >>> hash(memoryview(b""))
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: unhashable type: 'memoryview'
> 
> Compare with Python 2.7:
> 
> >>> hash(buffer(""))
> 0
> 
> memoryviews already support equality comparison:
> 
> >>> b"" == memoryview(b"")
> True
> 
> If the original object providing the buffer is hashable, then it
> seems to make sense for the memoryview object to be hashable. This came
> while porting Twisted to Python 3.
> 
> What do you think?
> 
> Regards
> 
> Antoine.
> 
> 


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