Problems retrieving items from a list using a reference rather than an integer - can you help?

Terry Reedy tjreedy at udel.edu
Thu Jul 17 20:33:42 EDT 2003


"Rogue9" <lol at lolmc.com> wrote in message news:3f15ca92 at shknews01...
> Hi,
> I´m trying to retrieve an item from a list using a reference called
> ´draw´' (which is an integer from 1 to 792 in a while loop) using:-

'draw' is a name (or maybe a variable) bound to a succession of
integers.  Calling it a reference is not generally helpful and may
someday mislead you.

> draw = 1
> while 1:
> if draw == 792:
> break
> b1 = someOtherList[draw-1]
> r1 = b1[draw]
> draw = draw+1

For newsgroup postings, spaces generally work better than tabs.

To make it easier to answer such questions, make your lists short
enough (say len() == 3) to post.  Make sure you copy and paste the
actual code executed.  Then copy and past the actual result and
explain what you wanted or expected that would be different.

Terry J. Reedy






More information about the Python-list mailing list