Guido van Rossum wrote:
I don't see how this can be fixed, because there's no way for
the list() constructor to know where the StopIteration is coming
from.
Sounds like a good analysis to me. No bug here. Move along, nothing to see here!
I decided a couple of days ago that the easiest 'fix' would be a minor
doc tweak. Aftef LibRef/Exceptions:
"exception StopIteration
Raised by builtin next() and an iterator‘s __next__() method to signal
that there are no further values."
add "Do not use this anywhere else."
or perhaps "Using this elsewhere may lead to undefined behavior."
I would include this with other suggestions for that section.
Then one wanting to be exact could write something like "Unless
StopIteration is abused, list(genexp) == [genexp], and so on."
tjr
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com