Message88166
Some (most?) of the itertools functions "generators" do not supprt "send".
>>> from itertools import count
>>> n = count(0)
>>> n.next()
0
>>> n.send(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'itertools.count' object has no attribute 'send'
>>>
However:
>>> def count(start):
... while 1:
... yield start
... start += 1
...
>>> n = count(0)
>>> n.next()
0
>>> n.send(1)
1
>>>
For some of the functions (such as count and repeat), "send" also make
sense. |
|
Date |
User |
Action |
Args |
2009-05-21 20:34:20 | tebeka | set | recipients:
+ tebeka |
2009-05-21 20:34:20 | tebeka | set | messageid: <1242938060.5.0.00936464962761.issue6080@psf.upfronthosting.co.za> |
2009-05-21 20:34:18 | tebeka | link | issue6080 messages |
2009-05-21 20:34:17 | tebeka | create | |
|