On 4/22/07, Christian Heimes <[EMAIL PROTECTED]> wrote: > Brett Cannon wrote: > > Implementation > > ============== > > > > 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. > > __import__(self.main)? I guess you wanted to write __import__(sys.main) :) >
Yep, that's what I meant. > > The newly proposed solution does introduce an added line of > > boilerplate which is a module import. But as the solution does not > > introduce a new built-in or module attribute (as discussed in > > `Rejected Ideas`_) it has been deemed worth the extra line. > > Someone on python-idea brought up the idea to add the sys module to > builtins. The feature would remove the requirement for an extra line and > the costs should be minimal or even zero since sys is a special builtin > module. > That's a separate PEP. > Some people including me like to resurrect the PEP 299 __main__() > function idea. http://www.python.org/dev/peps/pep-0299/ As I have already said multiple times on python-ideas, I don't personally like that idea. If someone wants to do the work to try to push that view then they can. -Brett _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
