I tried this in Python, thinking it would give me [(1,123), (2,123)]:
Python 2.7.3 (default, Feb 27 2014, 19:58:35)
>>> def my_generator():
... yield 123
...
>>> zip([1,2], my_generator())
[(1, 123)]
Why does zip stop after only one item is created? Is there a way for Pythonic to get what I was looking for?
source
share