Python handles globals badly.
Antoon Pardon
antoon.pardon at rece.vub.ac.be
Wed Sep 9 06:42:33 EDT 2015
Op 09-09-15 om 01:55 schreef Michael Torrie:
> In any case, 0-based indexing in Python makes a lot of sense when you
> bring in the slicing syntax. Especially if you think of slicing as
> operating on the boundaries between cells as it were.
Then you have never used slices with a negative step.
If slicing would operate on the boundaries between cells
then the reverse of lst[2:7] would be lst[7:2:-1] instead
it is lst[6:1:-1]
This gets you in trouble when you want to reverse through
lst[0:8] which would be lst[7:-1:-1] but now the special
meaning of negative indexes kicks in and you are screwed.
--
Antoon Pardon
More information about the Python-list
mailing list