[Python-Dev] [poll] New name for __builtins__

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Dec 1 00:59:08 CET 2007


Terry Reedy wrote:
> The only problem would be if someone put 
> the incantation into a non-main module named 'main.py', but the same is 
> true today of '__main__.py'.  And I would consider either a buggy practice.

I often put the "real" main code into a separate module, so
that it gets compiled to a .pyc, and sometimes I call that
module "main.py". So this change would break a lot of my
programs, and perhaps other people's as well.

I think the situation with __main__ is different from __builtin__,
because __builtin__ is an actual, specific module, whereas
__main__ is a pseudo-module which stands in for a different thing
in every Python program. So I'm in favour of keeping an
__xxx__ name for it, to emphasise its magic nature. I'm much
less likely to accidentally stomp on a magic name than a
non-magic one.

--
Greg


More information about the Python-Dev mailing list