tt = a, b = t
sholden at holdenweb.com
Mon Jan 14 13:54:38 CET 2002
"rihad" <rihad at mail.ru> wrote in message
news:qfm34uch7hrkc46jqqndpqc9nb657pv49j at 4ax.com...
> On Sun, 13 Jan 2002 18:58:25 GMT, Courageous <jkraska at san.rr.com>
> >>>> None
> Huh? This works! What are the reasons behind allowing to assign to a
> language construct???
This is Pythonicity at its most Pythonic. In actual fact the singleton value
None is by default associated with the name __builtins__.None -- which is to
say, any program component will be able to access this value, assuming that
the name None does not exist in any namespace taking prioirity over
__builtins__, which is the namespace of last resort.
So normally, when you execute a statement equivalent to
None = "Hi, Mom!"
you're creating a *local* binding to the name None, which your other code
will access in perference to the built-in as a result of the namespace
The real complication is that you can in fact execute a statement such as
__builtins__.None = "Perl is better!"
and in that case you may well find that things stop working as you would
expect, since you've stamped over a farily basic system assumption. But
Python is intended to elt you do this kind of thing, just so's you can
answer interesting "what if" questions :-)
If you *really* want trouble, try
The interpreter does its best to make up for the non-existent "None", but
it's hard going.
More information about the Python-list