[Python-Dev] Hashable memoryviews (original) (raw)
Guido van Rossum guido at python.org
Sun Nov 13 02:15:08 CET 2011
- Previous message: [Python-Dev] Hashable memoryviews
- Next message: [Python-Dev] Hashable memoryviews
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Aren't memoryview objects mutable? I think that the underlying memory can change, so it shouldn't be hashable.
On Sat, Nov 12, 2011 at 4:23 PM, 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 "", line 1, in 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 at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
-- --Guido van Rossum (python.org/~guido)
- Previous message: [Python-Dev] Hashable memoryviews
- Next message: [Python-Dev] Hashable memoryviews
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]