On May 25, 12:47 am, Carl Banks <pavlovevide...@gmail.com> wrote:
> The situation here is known.  It can't be corrected, even in Python 3,
> without modifying iterator protocol to tie StopIteration to a specific
> iterator.  This is possible and might be worth it to avoid hard-to-
> diagnose bugs but it would complicate iterator protocol, which becomes
> less useful as it becomes more complex.

The situation here is a known and could be corrected by changing the
meaning of list comprehension,
for instance by having [x for x in iterable] to be an alias for list(x
for x in iterable). In such a way the StopIteration exception would be
always swallowed and there would be consistency with generator
expressions (by construction). However, the list comprehension would
become non-equivalent to the corresponding for-loop with an .append,
so somebody would be un happy anyway :-/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to