In Python 2.4, although None can't be directly assigned to, globals()['None'] can still be; however, that won't change the value of the expression "None" in ordinary statements. Except with the eval function, it seems:

Python 2.4 (#2, Dec  3 2004, 17:59:05)
[GCC 3.3.5 (Debian 1:3.3.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print None
None
>>> print eval('None')
None
>>> globals()['None'] = "spam"
>>> print None
None
>>> print eval('None')
spam

I don't really mind this weird behavior; I'm just curious about it. Does anyone know what might be going on in Python's internals to cause the difference between "print None" and "print eval('None')"?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to