[Python-Dev] Making None a keyword

Steve Holden sholden@holdenweb.com
Fri, 26 Apr 2002 14:13:14 -0400


----- Original Message -----
From: "Guido van Rossum" <guido@python.org>
To: "Tim Peters" <tim.one@comcast.net>
Cc: <python-dev@python.org>
Sent: Friday, April 26, 2002 11:44 AM
Subject: Re: [Python-Dev] Making None a keyword


> > [Guido]
> > > ...
> > > It needs to add 'None' as an alternative to all other places where
> > > currently NAME occurs.
> >
> > Fudge.  None makes no sense anywhere in, e.g.,
> >
> > dotted_name: NAME ('.' NAME)*
> >
> > or
> >
> >     global_stmt: 'global' NAME (',' NAME)*
> >
> > but I suppose it has to be allowed for in 2.3 anyway else an existing
>
> Yes, that's (alas) the point.
>
> >     import None.None.None as None
> >
> > would yield a SyntaxError instead of a warning.
>
> More realistically,
>
>     def foo(a, None=None):
>         if a is None: ...
>
> I found 4 examples of this in Zope3 alone, and MAL has some too.
>
> > 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.
>
> A future statement makes no sense for this, so I guess all we can do
> in 2.3 is warn about use of None in all contexts except in
> expressions.
>
> This is really too bad -- I wish we could decide to just break code
> (since it's a clean break) but apparently that's unacceptable to the
> users.
>

Wouldn't it be nice if there were a collection of programs (perhaps those
owned by registered paranoids, but whatever) that you could use to get
statistics about breakage under some syntax change?

Clearly extending this through to run-time would add a huge testing
infrastructure that would need maintaining, but allowing people to add their
own codes to the syntax-checker base might mollify them a bit about the
prospect of future language change.

Call it the PythOnGuard (TM) database. :-) - if your programs would break
you'll be mailed before it's committed to production.

Back to the yardwork ...

regards
 Steve
--

home: http://www.holdenweb.com/
Python Web Programming:
http://pydish.holdenweb.com/pwp/



home: http://www.holdenweb.com/
Python Web Programming:
http://pydish.holdenweb.com/pwp/