import reassignment different at module and function scope

Brendan Miller catphive at catphive.net
Sat Jan 31 02:31:47 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If I:

import sys

sys = sys.version

This executes find but:

import sys

def f():
    sys = sys.version

This gives an error indicating that the sys on the right hand side of =
is undefined. What gives?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmD/mMACgkQ4eGWG/zYzOmrWgCbBLuD2HNDJJly3Z1KCPoNOB1G
sDgAoJ+gMCt9hWKuDUN30VUP40zqtbmJ
=+pND
-----END PGP SIGNATURE-----



More information about the Python-list mailing list