Re: None

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Fri, 10 Dec 1993 11:55:34 -0500

On Dec 10, 17:25, Guido.van.Rossum@cwi.nl wrote:
> >
> > Has this behaviour changed ?
> > Or is my memory totally false about what it USED to do ?
> >
> > Help!!! I'm about to dump core over this !!!
>
> I'm sorry, but this never worked. I sincerely hope you didn't pick
> it up from any code in the distribution (I challenge you to show where
> from).
>

I couldn't egrep anything similar from lib or demo/scripts so I believe
you. It must have been some random posted code - I KNOW I didn't think
of it myself. I can only assume that in the cases where I did use it,
the effects were in a local scope and got thrown away. This more
limited usage must have been the intent of the original user, but
somehow, increased familiarity fooled me into wrongly generalizing
it's safety.

> The key to understanding what happened in your example is that the
> *name* None gets no special treatment from the compiler -- it is just
> a name initialized in module builtin to the *value* None. BTW this
> won't happen easily in functions, since there the assignment to None
> creates a local variable named None which probably won't be used
> elsewhere in the function.
>
> What *does* work is "void = f(x)" where void can be any name not
> otherwise used. (I often use dummy().)
>

I used to use "junk", but when I saw the use of "None" - I though
that was so clear and obvious an indicator of intent, I picked it
up right away.

Clearly, as a *Python* question, this is of minimal interest.
What is interesting to me NOW, is the psychology: I have read
about the unreliability of eye-witness accounts, and reconstructed
memory,etc. What amazes me here is the vividness of my misremembered
memory that I actually tested it! Once I became familiar enough
with the construct to take it for granted, I must have "constructed"
the memory that I had actually explicitly tested it, when what
appears to have happened was that I overgeneralized from a specific
example.

[ This leads me to other ruminations on the psychology of computer
programming, which, luckily for YOU, I don't have time to go into
right now! But my recent overuse of the word "idiom" in connection
with programming languages is related to this direction: I've been
starting to look at programming languages more like real "languages"
than merely as "notations". ]

- Steve