Integers class...?
Greg Ewing
greg at cosc.canterbury.ac.nz
Sun Mar 10 22:55:59 EST 2002
Bernhard Herzog wrote:
>
> Slices support a step parameter, so
>
> for x in int[9:-1:-1]:
I don't consider that a good solution, for
two reasons:
(1) I'm not sure what the semantics are of
slices with negative steps. There are at
least 4 equally plausible interpretations of
[a:b:-c] if you count all the possible
combinations of endpoint swapping and
open/closed swapping.
(2) Even if the semantics are well-defined,
it's too mind-bending remembering and applying
them correctly in any given situation. It's
no better than range(a,b,-c) in that respect.
This is one of the things I was trying to
address with for x <= i < y.
--
Greg Ewing, Computer Science Dept, University of Canterbury,
Christchurch, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list