[Python-Dev] Making None a keyword (original) (raw)
Guido van Rossum guido@python.org
Fri, 26 Apr 2002 08:10:24 -0400
- Previous message: [Python-Dev] Making None a keyword
- Next message: [Python-Dev] Making None a keyword
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> I'd like to make None a keyword. This prevents dumb users from > assigning to it and screwing themselves, and can cause a slight > speedup because using None avoids two dict lookups. > > - Any objections?
+1 but only if you use the standard mechanism for this: warnings in 2.3, SyntaxError in 2.4.
Good point.
> - Can somebody help me implement this? I've got the parser changes > ready, but not the compiler changes. > > Believe it or not, Zope3 contains code that will break with this > change: there are functions with a default argument of the form > None=None as a speedup hack. I think this is an argument for the > change. :-)
Zope3 is not the only software using these kind of hacks to work around the builtins lookups.
I just realized there's another use for None as an identifier that is currently totally legal and which would become illegal: it's conceivable that someone would use None as an attribute name, e.g.
class C:
def None(self): pass
C().None()
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Making None a keyword
- Next message: [Python-Dev] Making None a keyword
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]