[Python-ideas] "Iteration stopping" syntax [Was: Is this PEP-able? for X in ListY while conditionZ:]

Joshua Landau joshua.landau.ws at gmail.com
Mon Jul 1 00:40:29 CEST 2013


On 30 June 2013 23:24, Andrew Barnert <abarnert at yahoo.com> wrote:
> I think a lot of people are looking at this wrong. In list(genexp), it's not the genexp part that's doing anything here; it's the list function. There's no way that it could distinguish between an explicit StopIteration and an implicit one, so it treats them the same way. If a comprehension is supposed to be the same as list(genexp) it should act like list--or like any other iteration mechanism you can write in Python or even in C--rather than acting magically as it currently does.

Damnit, you're so obviously right. Yeah, fine. Whatever.


More information about the Python-ideas mailing list