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

Steven Taschuk staschuk at telusplanet.net
Thu Jul 17 04:02:02 CEST 2003


Quoth Rogue9:
> draw = 1
> while 1:
> 	if draw == 792:
> 		break
> 	b1 = someOtherList[draw-1]
> 	r1 = b1[draw]
> 	draw = draw+1
> 
> However,the item I expect is not being retrieved i.e. a zero is the result
> of the retrieval rather than the integer in the list I was expecting.
> Furthermore,when I substitute an integer for draw e.g. r1 = b1[12],I
> do get the expected result.

Bizarre.  What is the value of someOtherList?

(And, as a side note, why not use a for loop, e.g.,
    for draw in range(1, 793):
        r1 = someOtherList[draw-1][draw]
        # and then, I assume, you actually do something with r1
?)

-- 
Steven Taschuk                            staschuk at telusplanet.net
Every public frenzy produces legislation purporting to address it.
                                                  (Kinsley's Law)





More information about the Python-list mailing list