Message250187
> 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! |
|
Date |
User |
Action |
Args |
2015-09-08 12:02:19 | ezio.melotti | set | recipients:
+ ezio.melotti, barry, rhettinger, ncoghlan, pitrou, martin.panter, serhiy.storchaka, yselivanov |
2015-09-08 12:02:19 | ezio.melotti | set | messageid: <1441713739.33.0.920266042263.issue25014@psf.upfronthosting.co.za> |
2015-09-08 12:02:19 | ezio.melotti | link | issue25014 messages |
2015-09-08 12:02:18 | ezio.melotti | create | |
|