Ezio Melotti added the comment: > Having spent a few days pondering this after Ezio first mentioned the > concept to me on IRC, I'm rejecting this on the basis of "not every 3 > line function needs to be in the standard library".
When I first mentioned this to Nick on IRC, the implementation of itercm() was a not-so-trivial function that called __enter__/__exit__ manually while catching StopIteration. It only occurred to me while posting this issue, that the same could be achieved with a simple `yield from` in a `with`. I also didn't realize that the __exit__ called in case of error in the attached example was triggered by the garbage collector. I therefore agree that a somewhat obscure and non-deterministic three-liner doesn't belong in the standard library. Thanks everyone for the feedback! ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25014> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com