inverse of izip

Steven Bethard steven.bethard at
Thu Aug 19 19:17:11 CEST 2004

Peter Otten <__peter__ at> wrote in message news:<cg1pct$p58$00$1 at>...
> However, your sample data is badly chosen. Unless I have made a typo
> repeating your demo, you are getting the same (last) sequence twice due to
> late binding of i.
> >>> map(list, starzip(it.izip("123", "abc")))
>  [['1', '2', '3'], ['a', 'b', 'c']]
> >>> x, y = starzip(it.izip("123", "abc"))
> >>> list(x)
>  ['a', 'b', 'c']
> >>> list(y)
>  ['a', 'b', 'c']
> >>>

I knew there was something funny about binding in generators, but I
couldn't remember what...  Could you explain why 'map(list, ...)'
works, but 'x, y = ...' doesn't?  I read the PEP, but I'm still not
clear on this point.



More information about the Python-list mailing list