[Python-Dev] Making None a keyword

Jeremy Hylton jeremy@zope.com
Fri, 26 Apr 2002 12:23:34 -0400


>>>>> "GN" == Gustavo Niemeyer <niemeyer@conectiva.com> writes:

  >> Note too that we can't change the generated code at all for 2.3
  >> unless under the control of a new future statement, else existing
  >> None-abusing code could break.

  GN> I'm trying to eat the cake and have it too, by detecting if None
  GN> is being abused and disabling the change of LOAD_GLOBAL to
  GN> LOAD_CONST. If it works (and probably will), we may then choose
  GN> to include warnings, keep it that way forever, or whatever.

This can't be detected statically, because a global could be
introduced dynamically:

foo.py:

def f():
    return None


>>> import foo
>>> foo.None = 12
>>> foo.f()
12

Jeremy