@@ -2376,8 +2376,8 @@ copying.
23762376 >>> data
23772377 bytearray(b'z1spam')
23782378
2379- Memoryviews of hashable (read-only) types are also hashable. The hash
2380- is defined as ``hash(m) == hash(m.tobytes()) ``::
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()) ``::
23812381
23822382 >>> v = memoryview(b'abcefg')
23832383 >>> hash(v) == hash(b'abcefg')
@@ -2387,21 +2387,13 @@ copying.
23872387 >>> hash(v[::-2]) == hash(b'abcefg'[::-2])
23882388 True
23892389
2390- Hashing of multi-dimensional objects is supported::
2391-
2392- >>> buf = bytes(list(range(12)))
2393- >>> x = memoryview(buf)
2394- >>> y = x.cast('B', shape=[2,2,3])
2395- >>> x.tolist()
2396- [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
2397- >>> y.tolist()
2398- [[[0, 1, 2], [3, 4, 5]], [[6, 7, 8], [9, 10, 11]]]
2399- >>> hash(x) == hash(y) == hash(y.tobytes())
2400- True
2401-
24022390 .. versionchanged :: 3.3
2403- Memoryview objects are now hashable.
2391+ Memoryview objects with formats 'B', 'b' or 'c' are now hashable.
24042392
2393+ .. 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.
24052397
24062398 :class: `memoryview ` has several methods:
24072399
0 commit comments