Stefan Behnel wrote:
While I agree with this being bad design, I do think that the above is a bug. It's a different thing if the iterable in the list comp/genexp raises a StopIteration, or if the conditional does it. And not silently catching anything raised by the latter sounds like the right thing to me.
From some experiments I just did using bare genexps and calling next() on them, I don't think anything is being silently caught in the genexp. What's happening is that the surrounding list() constructor is performing another level of iteration over the results of the genexp, and *that* is what's being stopped by the StopIteration. 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. Or maybe I misunderstand what you think the resolution of this should be. What behaviour do you want to see in this situation? -- Greg _______________________________________________ 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