Robert Bradshaw <[email protected]> writes:
> You're assigning x to several values in your list comprehension.

By the way, in Python 3, list comprehensions will have nested scope:

    [2] fs@boone ~ $ python2 -c 'x = 2; print(x); print([x**2 for x in 
range(5)]); print(x)'
    2
    [0, 1, 4, 9, 16]
    4
    [2] fs@boone ~ $ python3 -c 'x = 2; print(x); print([x**2 for x in 
range(5)]); print(x)'
    2
    [0, 1, 4, 9, 16]
    2

-Keshav

----
Join us in #sagemath on irc.freenode.net !

-- 
-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org



Reply via email to