On Thu, Sep 16, 2010 at 11:21 AM, Joel Goldstick <joel.goldst...@gmail.com> wrote: > > > On Thu, Sep 16, 2010 at 11:46 AM, Rance Hall <ran...@gmail.com> wrote: >> >> On Thu, Sep 16, 2010 at 9:24 AM, Joel Goldstick >> <joel.goldst...@gmail.com> wrote:
<snip> > This line is illustrative: > >> 13 for i in list[start:start+pagesize]: > > start is 0, pagesize is 2 so we get list[0:2] which means i gets the value > of what is in list[0], then next time list[1] then it stops > > list[0] IS 1, list[1] is 2 > > so: > 14 print ('%s. %s' % (i,list[i])) > > will print 1. list[1] which is 2 > > then print 2. list[2] which is 3 > > maybe what you want is this: > for i, value enumerate(list[start:start+pagesize], start): > print i, value > For some reason I wasn't seeing that I was iterating over the list contents not the list indexes, and because in my sample data both were numbers it worked but not how I wanted it too, Damn that dyslexia, oh well. Thanks for helping me through it. By the way, this also works as I expect: for i in range(start, start+pagesize): also gives me what I want to see. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor