Message187431
We can't make ordinary generators innately context managers, as it makes the error too hard to detect when you accidentally leave out @contextmanager when using a generator to write a custom one.
You can already use contextlib.closing to forcibly close them when appropriate, so providing a decorator to implicitly map __exit__ to close wouldn't really save much. |
|
| Date |
User |
Action |
Args |
| 2013-04-20 14:55:34 | ncoghlan | set | recipients:
+ ncoghlan, amaury.forgeotdarc, pitrou, vstinner, benjamin.peterson, docs@python, Anssi.Kääriäinen, pconnell, isoschiz |
| 2013-04-20 14:55:34 | ncoghlan | set | messageid: <[email protected]> |
| 2013-04-20 14:55:34 | ncoghlan | link | issue17468 messages |
| 2013-04-20 14:55:33 | ncoghlan | create | |
|