enumerate() question

Damjan gdamjan at gmail.com
Mon May 22 10:36:28 EDT 2006


> I have a question for the developer[s] of enumerate(). Consider the
> following code:
> 
> for x,y in coords(dots):
>     print x, y
> 
> When I want to iterate over enumerated sequence I expect this to work:
> 
> for i,x,y in enumerate(coords(dots)):
>     print i, x, y

for i, (x, y) in enumerate(coords(dots)):
   print i, x, y

-- 
damjan



More information about the Python-list mailing list