フードの下ではどのように機能しますか?python:いつ発電機を開梱できますか?
>>> def f():
... yield 1,2
... yield 3,4
...
>>> *f()
File "<stdin>", line 1
*f()
^
SyntaxError: invalid syntax
>>> zip(*f())
[(1, 3), (2, 4)]
>>> zip(f())
[((1, 2),), ((3, 4),)]
>>> *args = *f()
File "<stdin>", line 1
*args = *f()
^
SyntaxError: invalid syntax
['itertools.consume'](http://docs.python.org/library/itertools.html#recipes)をお探しですか? – katrielalex
彼は 'list(f())'や 'tuple(f())'を探していると思います。 –
申し訳ありませんが、ジェネレータがどのように動作し、どこで使用できるかをもっと知りたいと思っていました。 –