Questions regarding design decisions in listobject.c

Martijn Faassen m.faassen at vet.uu.nl
Wed Jun 7 11:55:07 EDT 2000


Courageous <jkraska1 at san.rr.com> wrote:
[snip]
> Well, yeah, but [0:3] as "element zero through three, inclusive"
> is about as intuitive as you can get. While I understand completely
> how the current implementation works (reading the source code and
> all, dontcha know), I still fail to see *why* this was chosen.

a[0:i] + a[i:] == a

a[0:len(a)] == a

Inserting a list at index i:

a[:i] + b + a[i:]

In practice, no need to think about a *lot* of off-by-one errors.

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list