list comprehensions put non-names into namespaces!

skip at pobox.com skip at pobox.com
Thu May 25 15:42:33 EDT 2006


    Lonnie> List comprehensions appear to store their temporary result in a
    Lonnie> variable named "_[1]" (or presumably "_[2]", "_[3]" etc for
    Lonnie> nested comprehensions)

Known issue.  Fixed in generator comprehensions.  Dunno about plans to fix
it in list comprehensions.  I believe at some point in the future they may
just go away or become syntactic sugar for a gen comp wrapped in a list()
call.

Skip



More information about the Python-list mailing list