[Python-3000] Is this a bug with list comprehensions or not? (original) (raw)

Aahz aahz at pythoncraft.com
Wed Jul 9 17:35:02 CEST 2008


On Wed, Jul 09, 2008, Carl Johnson wrote:

Python 3.0a5 (r30a5:62856, May 10 2008, 10:34:28) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> def f(x): ... if x > 5: raise StopIteration ... >>> [x for x in range(100) if not f(x)] Traceback (most recent call last): File "", line 1, in File "", line 1, in File "", line 2, in f StopIteration >>> list(x for x in range(100) if not f(x)) [0, 1, 2, 3, 4, 5] Certainly, it's an inconsistency compared to generator expressions, but is it a bug?

Dunno whether it's a bug, but please file a bug report to track this

Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/

"as long as we like the same operating system, things are cool." --piranha



More information about the Python-3000 mailing list