[Python-3000] Is this a bug with list comprehensions or not?
solipsis at pitrou.net
Sun Jul 13 14:37:50 CEST 2008
Greg Ewing <greg.ewing <at> canterbury.ac.nz> writes:
> This seems like a lot of trouble to go to in order to
> fix a rather obscure problem. Is it really a serious
> enough problem in practice? Anyone have any real-life
> stories about this?
Agreed. I think it is ok for some behaviours to be unspecified and seemingly
"inconsistent" if one goes beyond the prescripted use of certain constructs.
One classical example is:
>>> 1+1 is 1+1
>>> 1000+1000 is 1000+1000
Solving the problem at hand would require carefully flagging StopIteration
exceptions to know whether they were raised in an iterator implementation
context or not, or even downright forbidding raising them in a non-iterator
implementation context. It's a lot of complication for such a corner case.
More information about the Python-3000