[Python-Dev] towards a faster Python

M.-A. Lemburg mal@lemburg.com
Tue, 10 Jun 2003 16:55:24 +0200


Guido van Rossum wrote:
>>I am talking about what mxTools is doing: adding new builtins to
>>the interpreter by placing them into the __builtins__ dictionary.
>>While I agree that it is usually better to use something like
>>'from x import *' or even naming the tools explicitly, some features
>>in mxTools do warrant being made builtins, e.g. irange() has been
>>most helpful in the past :-)
> 
> You're not going to convince me to endorse that practice.  End of story.

I'm not asking you for endorsement :-) Just wanted to note that
Python's dynamic features are actually being used in this case
(and have been for years).

BTW, I don't see any problem with optimizing the builtins
access regardeless of whether adding builtins is considered good
or bad. Caching the lookups for globals in code objects seems like
a good way to increase performance without having to change a single
line of code and builtins a great candidate for cacheable
globals (I'd even make all functions and classes at module
top-level cacheable per default if Python is run under -OO).

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Software directly from the Source  (#1, Jun 10 2003)
 >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
EuroPython 2003, Charleroi, Belgium:                        14 days left