[Python-Dev] Making None a keyword

Tim Peters tim.one@comcast.net
Fri, 26 Apr 2002 13:27:37 -0400


[Tim]
> Yup, good point, 'None' does make sense as the first NAME in the
> dotted_name production.

[Guido]
> No, dotted_name is only used in import statements.

[Jeremy]
> None is a valid package name.

But it won't be when None becomes a keyword.  We shouldn't change the
grammar now anyway, so let's fight instead about which names *should* become
keywords eventually (== which should generate warnings in 2.3 for non-rvalue
uses).

import string
import __builtin__

candidates = [k for k in dir(__builtin__)
              if k[0] in string.ascii_uppercase and
                 not k.endswith('Error') and
                 not k.endswith('Warning')]

for k in candidates:
    print k


displays:

    Ellipsis
    Exception
    False
    KeyboardInterrupt
    None
    NotImplemented
    StopIteration
    SystemExit
    True

in current CVS.

    Ellipsis
    False
    None
    NotImplemented
    True

are the builtin singleton data constants, so I'm +1 on those.  The others
are exception classes; -0 from me.