why does this unpacking work

Piet van Oostrum piet at cs.uu.nl
Tue Nov 7 12:11:51 CET 2006


>>>>> Carsten Haese <carsten at uniqsys.com> (CH) wrote:

>CH> On Fri, 2006-10-20 at 15:14, John Salerno wrote:

>>> What seems to be happening is that 'for x,y in t' is acting like:
>>> 
>>> for x in t:
>>> for y,z in x:
>>> #then it does it correctly

>CH> No, it's actually behaving like

>CH> for x in t:
>CH>   y,z = t
       y,z = x
>CH>   # do something with y and z

-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list