]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
SF patch #408326 by Robin Thomas: slice objects comparable, not
authorGuido van Rossum <guido@python.org>
Tue, 20 Mar 2001 12:41:34 +0000 (12:41 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 20 Mar 2001 12:41:34 +0000 (12:41 +0000)
commita1351fbd884189329bbcb6c688ca992fc1afc3f6
tree07d8f335f81d188eeb0a33128a7abb514466f92d
parent26ae7cd75a0e33b98a5156e1d4501be66e39a79f
SF patch #408326 by Robin Thomas: slice objects comparable, not
hashable

This patch changes the behavior of slice objects in the following
manner:

- Slice objects are now comparable with other slice objects as though
they were logically tuples of (start,stop,step). The tuple is not
created in the comparison function, but the comparison behavior is
logically equivalent.

- Slice objects are not hashable. With the above change to being
comparable, slice objects now cannot be used as keys in dictionaries.

[I've edited the patch for style.  Note that this fixes the problem
that dict[i:j] seemed to work but was meaningless.  --GvR]
Objects/sliceobject.c