None assigment

Steve Holden sholden at holdenweb.com
Thu Feb 8 13:52:31 EST 2001


"D-Man" <dsh8290 at rit.edu> wrote in message
news:mailman.981656286.3737.python-list at python.org...
[ ... ]
>
> Interesting.  So normally "None" is a special keyword (that is a
> reference to an object) ,  but that doesn't prevent one from creating
> a local variable named "None" that shadows the keyword.
>
Nope, it's just in __builtins__, and remains there whether you bind the same
name in the module scope or not. You can delete it from the module scope,
thereby making the one in __builtins__ visible once more.  And, as I pointed
out in an earlier posting, you can even bind __builtins__.None to a new
value if you want, to the confusion of all.

regards
 Steve





More information about the Python-list mailing list