[Python-3000] __builtin__ and __builtins__

Barry Warsaw barry at python.org
Mon Mar 12 23:27:09 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mar 12, 2007, at 6:12 PM, Greg Ewing wrote:

> Seems to me it would be better to rename the module
> to a non-double-underscore name. There's really nothing
> magical about the module itself, only the name used
> by global variable lookups. So just call the module
> 'builtins', and then you can do
>
>     import builtins   # get the module with no magic happening
>
>     import mystuff as __builtins__ # change my builtin namespace
>
>     import builtins as __builtins__  # restore default builtin  
> namespace

+1

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iQCVAwUBRfXTvnEjvBPtnXfVAQLRGAQAoZFNRze7dmJE6CvIKY1fNeUegfhBcJ4G
NMkCjiWdjUXbfx7kqF66f/acQJvA9Zpw6EMlOkvsNdsgIDRB5VQsvc4EIpmLj2Mu
DnPHPQt5hfK9J0HghUbTh0hVe+OatCArAKe/EkdcHDrgnohQGvAJx8ljFifvECx9
SgACSxZwvRk=
=0axI
-----END PGP SIGNATURE-----


More information about the Python-3000 mailing list