New submission from pyos:

Since "yield from" made it into Python 3.3, I think it would be useful to chain 
multiple generators and still get a generator, not an iterator. That is, the 
following code:

def f():
    yield from itertools.chain(A, B, C)

should be (at least roughly) equivalent to

def f():
    yield from A
    yield from B
    yield from C

while still allowing to send() values to whichever subgenerator is currently 
running or throw() exceptions inside them.

The attached patch adds this functionality to itertools.chain objects.

----------
components: Extension Modules
files: itertools-chain-send-throw-and-close.diff
keywords: patch
messages: 172204
nosy: pyos, rhettinger
priority: normal
severity: normal
status: open
title: Implement generator interface in itertools.chain.
versions: Python 3.3, Python 3.4, Python 3.5
Added file: 
http://bugs.python.org/file27455/itertools-chain-send-throw-and-close.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16150>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to