[Python-3000] PEP to change how the main module is delineated
nnorwitz at gmail.com
Mon Apr 23 05:12:40 CEST 2007
Can you add refs to all the PEPs?
Will this go into 2.6 also? If so, you should send to python-dev too.
If this is accepted, can you update the 2.6 PEP 361.
On 4/22/07, Brett Cannon <brett at python.org> wrote:
> When the ``-m`` option is used, ``sys.main`` will be set to the
> argument passed in. ``sys.argv`` will be adjusted as it is currently.
> Then the equivalent of ``__import__(self.main)`` will occur. This
> differs from current semantics as the ``runpy`` module fetches the
> code object for the file specified by the module name in order to
> explicitly set ``__name__`` and other attributes. This is no longer
> needed as import can perform its normal operation in this situation.
> If a file name is specified, then ``sys.main`` will be set to
> ``"__main__"``. The specified file will then be read and have a code
> object created and then be executed with ``__name__`` set to
> ``"__main__"``. This mirrors current semantics.
What happens when no file is passed in (ie, interactive) or when -c is used?
Will sys.main be set? If so, to what?
More information about the Python-3000