[issue13814] Generators as context managers.

Arkadiusz Wahlig report at bugs.python.org
Wed Jan 18 11:43:16 CET 2012


New submission from Arkadiusz Wahlig <arkadiusz.wahlig at gmail.com>:

Generators should support the with statement with __exit__ calling self.close().

with genfunc() as g:
    for item in g:
        print(item)

----------
messages: 151530
nosy: yak
priority: normal
severity: normal
status: open
title: Generators as context managers.
type: enhancement
versions: Python 2.7, Python 3.4

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


More information about the Python-bugs-list mailing list