Re: None

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Fri, 10 Dec 1993 12:05:04 -0500

On Dec 10, 11:53, jredford@lehman.com wrote:
>
> I use 'void' for assignment throwaway. None is a special object to
> start with. After you assign to it, I suspect it ceases to be.
>
> --

It's still there, but masked by the creation of a new 'None':

>>> None
>>> None = 1
>>> None
1
>>> import builtin
>>> builtin.None
>>>

As Guido stated, in a module or procedure, this will create a
new local None.
I uncovered my problem when I edited a module that assigned to
None, and inserted an assignment to another variable OF None
before that assignment. The compiler then complained with a
NameError: the use of None on the LHS told it to create a new
local variable, but the use on the RHS before it had a value
was an error. ( without the assignment, it would have used the
Global value of None. )

I only continue to beat this dead horse into the ground because
it displays some of the peculiarities of scope.

- Steve