[Python-ideas] PEP for executing a module in a package containing relative imports
brett at python.org
Sat Apr 21 08:18:20 CEST 2007
On 4/20/07, Steven Bethard <steven.bethard at gmail.com> wrote:
> On 4/20/07, Brett Cannon <brett at python.org> wrote:
> > Exactly. Python 2.6 will still have __name__ set to '__main__', but
> > also have __main__ set. Python 3.0 will not change __name__ at all.
> That should be Python 3.0 will not change __main__ at all, right?
> Because __name__ is going to change from being "__main__" in the main
> module to being the actual module name in Python 3.0, right?
> Assuming that's right, I think it was unclear to me that you wanted to
> add __main__ to Python 2.x. Probably chainging:
> First, a Py3K deprecation warning will be raised...
> First, each module will gain a __main__ attribute and a Py3K
> deprecation warning will be raised...
> would make the intent clearer.
Yes, __main__ will be defined in 2.6 and a warning raised if someone
defines __main__ later on in the module.
More information about the Python-ideas