New submission from Miki Tebeka <miki.teb...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue6080>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to