On 16/01/16 23:56, Alan Gauld wrote:
> On 16/01/16 22:39, boB Stepp wrote:
> 
>> So in this model of understanding negative list indexing, should it be:
>>
>> mylist = [ 100, 200, 300, 400, 500 ]
>>           ^    ^    ^    ^    ^   ^
>>           -5   -4   -3   -2   -1  ?
>>
>> Well, it has to be this; otherwise, the off-by-one error exist.  This
>> also continues to explain why
>>
>> mylist.insert(-1, x)
>>
>> inserts x *before* 500.  But in this model, what should go in the place of 
>> "?"?
> 
> -0
> 

I should have added a :-/ to that in case it wasn't obvious...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to