[Python-3000] Making more effective use of slice objects in Py3k
greg.ewing at canterbury.ac.nz
Tue Aug 29 03:20:58 CEST 2006
Ron Adam wrote:
> 1. Remove None stored as indices in slice objects. Depending on the step
> value, Any Nones can be converted to 0 or -1 immediately,
But None isn't the same as -1 in a slice. None means the end
of the sequence, whereas -1 means one less than the end.
I'm also not all that happy about forcing slice indices to
be ints. Traditionally they are, but someone might want to
define a class that uses them in a more general way.
> Once the slice is created the Nones are not needed, valid index values
> can be determined.
I don't understand what you mean here. Slice objects themselves
know nothing about what object they're going to be used to
slice, so there's no way they can determine "valid index
values" (or even *types* -- see above).
More information about the Python-3000