This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients barry, ezio.melotti, martin.panter, ncoghlan, pitrou, rhettinger, serhiy.storchaka, yselivanov
Date 2015-09-08.12:02:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1441713739.33.0.920266042263.issue25014@psf.upfronthosting.co.za>
In-reply-to
Content
> 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!
History
Date User Action Args
2015-09-08 12:02:19ezio.melottisetrecipients: + ezio.melotti, barry, rhettinger, ncoghlan, pitrou, martin.panter, serhiy.storchaka, yselivanov
2015-09-08 12:02:19ezio.melottisetmessageid: <1441713739.33.0.920266042263.issue25014@psf.upfronthosting.co.za>
2015-09-08 12:02:19ezio.melottilinkissue25014 messages
2015-09-08 12:02:18ezio.melotticreate