Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a3b84fb

Browse files
author
Stefan Krah
committed
Issue #15814: Documentation: disallow hashing of multi-dimensional memoryviews.
1 parent 6a42bd6 commit a3b84fb

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

Doc/library/stdtypes.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,8 +2376,9 @@ copying.
23762376
>>> data
23772377
bytearray(b'z1spam')
23782378

2379-
Memoryviews of hashable (read-only) types with formats 'B', 'b' or 'c'
2380-
are also hashable. The hash is defined as ``hash(m) == hash(m.tobytes())``::
2379+
One-dimensional memoryviews of hashable (read-only) types with formats
2380+
'B', 'b' or 'c' are also hashable. The hash is defined as
2381+
``hash(m) == hash(m.tobytes())``::
23812382

23822383
>>> v = memoryview(b'abcefg')
23832384
>>> hash(v) == hash(b'abcefg')
@@ -2388,12 +2389,13 @@ copying.
23882389
True
23892390

23902391
.. versionchanged:: 3.3
2391-
Memoryview objects with formats 'B', 'b' or 'c' are now hashable.
2392+
One-dimensional memoryviews with formats 'B', 'b' or 'c' are now hashable.
23922393

23932394
.. note::
2394-
Hashing of memoryviews with formats other than 'B', 'b' or 'c' is
2395-
possible in version 3.3.0, but will raise an error in 3.3.1 in order
2396-
to be compatible with the new memoryview equality definition.
2395+
Hashing of memoryviews with formats other than 'B', 'b' or 'c' as well
2396+
as hashing of multi-dimensional memoryviews is possible in version 3.3.0,
2397+
but will raise an error in 3.3.1 in order to be compatible with the new
2398+
memoryview equality definition.
23972399

23982400
:class:`memoryview` has several methods:
23992401

0 commit comments

Comments
 (0)