[New-bugs-announce] [issue6080] Itertools objects are missing "send"

Miki Tebeka report at bugs.python.org
Thu May 21 22:34:20 CEST 2009


New submission from Miki Tebeka <miki.tebeka at gmail.com>:

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.

----------
components: Library (Lib)
messages: 88166
nosy: tebeka
severity: normal
status: open
title: Itertools objects are missing "send"
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6080>
_______________________________________


More information about the New-bugs-announce mailing list