why does this unpacking work
John Salerno
johnjsal at NOSPAMgmail.com
Fri Oct 20 16:29:50 EDT 2006
Carsten Haese wrote:
> You seem to have difficulty distinguishing the concept of looping over a
> tuple from the concept of unpacking a tuple.
I think you're right. It's starting to make more sense now. I think when
I saw:
for x,y in t
I was expecting 't' to be a two-tuple for it to work. Maybe writing it as:
for (x,y) in t
sort of helps to show that '(x,y)' is equivalent to one object in 't'.
That makes it look a little more cohesive in my mind, I guess, or helps
me to see it map out against 't' better.
More information about the Python-list
mailing list