True, False, None (was re. Pruss's manifesto)
John Roth
newsgroups at jhrothjr.com
Mon Nov 10 15:49:52 EST 2003
"Thomas Bellman" <bellman at lysator.liu.se> wrote in message
news:boop38$c2l$1 at news.island.liu.se...
> Alex Martelli <aleax at aleax.it> wrote:
>
> > True, False and None may well become keywords in the future, because
that
> > might make things "even finer" in some respects. E.g., right now,
> > while True:
> > ...
> > has to look-up 'True' at EACH step just in case the ... code rebinds
> > that name. This _is_ a bit silly, when there is no real use-case for
> > "letting True be re-bound". Nothing major, but...:
>
> That's a silly reason to make them keywords. A much better way
> to achieve the same goal would be to make the optimizer recognize
> that True isn't re-bound within the loop. Making the optimizer
> better would improve the performance of much more code than just
> 'while True' loops.
Making them keywords isn't exactly correct. There's a movement
to make just about everything in the built-in scope immutable and
not rebindable at any lower scope for performance reasons. The
usual example is the len() built-in function. All this function does is
call the __len__() method on the object; the extra function call
is a complete waste of time, and could be eliminated if the
compiler could depend on len() never being modified or
rebound at any level.
John Roth
>
>
> --
> Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
> "You cannot achieve the impossible without ! bellman @ lysator.liu.se
> attempting the absurd." ! Make Love -- Nicht Wahr!
More information about the Python-list
mailing list