R. David Murray <rdmur...@bitdance.com> added the comment:

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.

----------
nosy: +r.david.murray
stage:  -> needs patch
title: abusive language in __name__ description -> Unclear language in __main__ 
description
versions: +Python 2.7, Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15104>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to