James Carroll wrote:
If you have five elements, numbered 0,1,2,3,4  and you ask for the
elements starting with the first one, and so on for the length you
would have [0:length].  So [0:5] gives you elemets 0,1,2,3,4.   Think
of the weirdess if you had to ask for [0:length-1] to get length
elements...
[...]
It is a little weired that slicing does [index: count] instead of
[index:index] or [count:count] I agree, but python really does just
flow wonderfully once you see how clean code is that's written [index:
count].

I think you got confused part way through that. Python's slices are *not* index:count, but are index:index. It's just that for the example you gave, starting at 0, they happen to amount to the same thing...

-Peter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to