summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-11-21 19:46:33 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-11-21 19:46:33 (GMT)
commitce4a9da70535b4bb9048147b141f01004af2133d (patch)
tree853fa7484683a9c858f29bfab1320fb4baee5d98 /Doc
parent0a3229de6b80cfa9e432ef5a9c72548569503075 (diff)
downloadcpython-ce4a9da70535b4bb9048147b141f01004af2133d.zip
cpython-ce4a9da70535b4bb9048147b141f01004af2133d.tar.gz
cpython-ce4a9da70535b4bb9048147b141f01004af2133d.tar.bz2
Issue #13411: memoryview objects are now hashable when the underlying object is hashable.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/stdtypes.rst13
1 files changed, 13 insertions, 0 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 3345258..cdb2a4a 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -2401,6 +2401,19 @@ copying. Memory is generally interpreted as simple bytes.
Notice how the size of the memoryview object cannot be changed.
+ Memoryviews of hashable (read-only) types are also hashable and their
+ hash value matches the corresponding bytes object::
+
+ >>> v = memoryview(b'abcefg')
+ >>> hash(v) == hash(b'abcefg')
+ True
+ >>> hash(v[2:4]) == hash(b'ce')
+ True
+
+ .. versionchanged:: 3.3
+ Memoryview objects are now hashable.
+
+
:class:`memoryview` has several methods:
.. method:: tobytes()