Why Python does *SLICING* the way it does??
Roy Smith
roy at panix.com
Wed Apr 20 09:36:51 EDT 2005
Antoon Pardon <apardon at forel.vub.ac.be> wrote:
> Personnaly I would like to have the choice. Sometimes I prefer to
> start at 0, sometimes at 1 and other times at -13 or +7.
Argggh. Having two (or more!) ways to do it, would mean that every time I
read somebody else's code, I would have to figure out which flavor they are
using before I could understand what their code meant. That would be evil.
What would actually be cool is if Python were to support the normal math
notation for open or closed intervals. Any of the following would make
sense:
foo = bar (1, 2)
foo = bar (1, 2]
foo = bar [1, 2)
foo = bar [1, 2]
That would certainly solve this particular problem, but the cost to the
rest of the language syntax would be rather high :-)
More information about the Python-list
mailing list