[New-bugs-announce] [issue17433] stdlib generator-like iterators don't forward send/throw

Thomas Wouters report at bugs.python.org
Fri Mar 15 23:37:48 CET 2013


New submission from Thomas Wouters:

In response to a question asked at Brett Cannon's Python 3.3 talk at PyCon, it occurs to me the iterators in the itertools module should participate in generator sending, so that you can do this:

def report_first_ten(g):
    s = itertools.islice(g, 10)
    yield from s
    print("First 10 done.")
    yield from g

and then send (or throw) into the report_first_ten() generator, it fails (because itertools.islice() has no send method.) Similarly, perhaps itertools.izip() should gain a send method that sends into the iterators it's zipping, etc.

----------
components: Library (Lib)
messages: 184273
nosy: twouters
priority: normal
severity: normal
status: open
title: stdlib generator-like iterators don't forward send/throw
versions: Python 3.4

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


More information about the New-bugs-announce mailing list