[Python-Dev] Making None a keyword

Guido van Rossum guido@python.org
Tue, 30 Apr 2002 08:50:16 -0400


[Guido]
> > atom: '(' [testlist] ')' | '[' [listmaker] ']' | '{' [dictmaker] '}'
> >   | '`' testlist '`' | NAME | NUMBER | STRING+ | 'None'
> > 
> > It needs to add 'None' as an alternative to all other places where
> > currently NAME occurs.

[Greg E]
> Wait a minute, you're going about this all wrong!
> 
> Instead of making None a reserved word, why not just make it
> a non-reserved keyword when used as a variable name?

What's that?

> Then you wouldn't have to change the grammar at all, and there would
> be no problem with the use of None in other contexts, such as
> attribute names.

Unfortunately, what's a variable in one context is an attribute in
another.

I don't think I *want* people to use None as an attribute name (or in
any other context).

--Guido van Rossum (home page: http://www.python.org/~guido/)