[Python-Dev] towards a faster Python

Bernhard Herzog bh@intevation.de
10 Jun 2003 17:57:23 +0200


Kevin Jacobs <jacobs@penguin.theopalgroup.com> writes:

> On Tue, 10 Jun 2003, 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.
> 
> While not trying to convince you, I do have to say that we use this trick to
> provide implementations of builtins to code running under older Python
> versions.

There's even precedence in the standard library for modifying __builtins__:

(gettext.py, lines 219ff):

    def install(self, unicode=False):
        import __builtin__
        __builtin__.__dict__['_'] = unicode and self.ugettext or self.gettext

  Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                           http://www.mapit.de/