Indexing Into A Tuple

Erik Max Francis max at alcyone.com
Wed Jun 27 15:09:59 EDT 2001


Tim Daneliuk wrote:

> for x, y in MyTuple:
>         print x, y
> 
> Intuitively (and, obviously, incorrectly) it seems to me that the 1st
> time through, the second example should return:
> 
>       x=("a", "b") and y=("c", "d")
> 
> Instead, it returns x="a", and y="b" just like the first example.
> 
> Why?

It means the same thing as

	for z in MyTuple:
	    x, y = z
            print x, y

See it now?

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Bachelors have consciences, married men have wives.
\__/ H.L. Mencken
    Alcyone Systems' Daily Planet / http://www.alcyone.com/planet.html
 A new, virtual planet, every day.



More information about the Python-list mailing list