Feb. 3, 2017
6:21 a.m.
On Feb 2, 2017, at 2:17 AM, Anders Munch <ajm@flonidan.dk> wrote:
Give Python 2 a little more credit.
We are, it told you what your issue was: yield outside a function. Consider:
def f(): ... l = [(yield 1) for x in range(10)] ... print(l) gen = f() for i in range(11): ... gen.send(i or None) ... 1 1 1 1 1 1 1 1 1 1 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
But this is a very convoluted "feature" and likely people don't expect *this* to be what's happening. - Ł