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.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to