This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients docs@python, hynek, loewis, r.david.murray, techtonik
Date 2012-06-19.12:48:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340110096.11.0.0030469386472.issue15104@psf.upfronthosting.co.za>
In-reply-to
Content
Hmm.  I think that chapter could use a more extensive rewrite with some additional information provided.  For example, you actually can have a __main__ module in a package, and anything inside it will execute when the package is run via -m.

The "otherwise anonymous" is a bit misleading, I think.  The real distinction is that when a module is run as a script, __name__ is set to __main__, whereas when it is imported, __name__ is the module name.  This distinction allows a module to easily detect when it is being run as a script rather than imported, and the "idiomatic 'conditional script' stanza" is how to implement the behavior of a module conditionally acting as a script depending on how it is accessed.
History
Date User Action Args
2012-06-19 12:48:16r.david.murraysetrecipients: + r.david.murray, loewis, techtonik, docs@python, hynek
2012-06-19 12:48:16r.david.murraysetmessageid: <1340110096.11.0.0030469386472.issue15104@psf.upfronthosting.co.za>
2012-06-19 12:48:15r.david.murraylinkissue15104 messages
2012-06-19 12:48:13r.david.murraycreate