Creating True Global Functions by Modifying Builtins

Andrew Clover and-google at doxdesk.com
Thu Jun 10 06:46:47 EDT 2004


Peter Hansen <peter at engcorp.com> wrote:

> The only time I've found a valid reason to stick stuff in __builtin__
> is when trying to make current code *forward compatible* with newer
> versions of Python, such as when bool() and True/False where added
> in 2.2 (?) and we had to stick with 2.0.

Even this isn't really a good idea. Many other modules have various
different workarounds for lack of feature support, which if you are
unlucky can get confused by builtin-hacking.

Having a 'constants' module from which a package can from ... import *
is usually a better approach.

-- 
Andrew Clover
mailro:and at doxdesk.com
http://www.doxdesk.com/



More information about the Python-list mailing list