[issue15104] Unclear language in __main__ description

2020-12-01 Thread Irit Katriel


Irit Katriel  added the comment:

Fixed for Python 3, too late for Python 2.

--
nosy: +iritkatriel
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-05-02 Thread Éric Araujo

Éric Araujo added the comment:

Docs and indexing/cross-links in 2.7 should indeed be improved.  I had 
forgotten which of 2.6 or 2.7 added support for executing packages thanks to 
__main__.py files and the docs don't contain an answer that's comprehensive and 
easy to find.

--
assignee: docs@python - eric.araujo
nosy: +eric.araujo
stage: patch review - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-04-14 Thread Sam Lucidi

Sam Lucidi added the comment:

I've attempted to synthesize the ideas in this thread into a clearer 
explanation of __main__. What I've written doesn't attempt to explain anything 
else about module naming, but it does try to address the common package and 
module uses of __main__.

--
keywords: +patch
nosy: +mansam
Added file: 
http://bugs.python.org/file34820/clarify-__main__-documentation.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-04-14 Thread R. David Murray

R. David Murray added the comment:

I've made some review comments.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-04-14 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
stage: needs patch - patch review
versions: +Python 3.5 -Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-04-14 Thread Sam Lucidi

Sam Lucidi added the comment:

Thanks, I've revised the change based on your comments.

--
Added file: 
http://bugs.python.org/file34822/clarify-__main__-documentation.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-04-14 Thread Sam Lucidi

Changes by Sam Lucidi man...@csh.rit.edu:


Added file: 
http://bugs.python.org/file34831/clarify-__main__-documentation-backticks.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-04-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4f23648b7c97 by R David Murray in branch '3.4':
#15104: improve the discussion of __main__.
http://hg.python.org/cpython/rev/4f23648b7c97

New changeset 94ac365bf1b7 by R David Murray in branch 'default':
Merge: #15104: improve the discussion of __main__.
http://hg.python.org/cpython/rev/94ac365bf1b7

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-04-14 Thread R. David Murray

R. David Murray added the comment:

Thanks, Sam.  I did not apply this to 2.7 because I'm not sure if the 
__main__.py is supported there.  Can someone check?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-04-14 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
Removed message: http://bugs.python.org/msg216177

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-04-14 Thread R. David Murray

R. David Murray added the comment:

Thanks, Sam.  I did not apply this to 2.7 because I'm not sure if the 
__main__.py is supported there.  Can someone check?

--
type: enhancement - behavior
versions:  -Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-04-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am a bit puzzled. According to
https://docs.python.org/2.7/using/cmdline.html#interface-options __main__.py 
(not indexed) has been supported since 2.5. On the other hand, recursively 
grepping Lib for 'e' in __main__.py files hits about 20 files in 3.4 but only 2 
in 2.7. Moreover, those two files fail for trying to do relative imports: from 
.main import main, TestProgram, USAGE_AS_MAIN.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2014-04-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 008486e18e90 by R David Murray in branch '3.4':
#15104: add backtick code markup.
http://hg.python.org/cpython/rev/008486e18e90

New changeset 14e874736d3a by R David Murray in branch 'default':
Merge: #15104: add backtick code markup.
http://hg.python.org/cpython/rev/14e874736d3a

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15104
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15104] Unclear language in __main__ description

2012-11-12 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

___
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



[issue15104] Unclear language in __main__ description

2012-11-02 Thread Hynek Schlawack

Changes by Hynek Schlawack h...@ox.cx:


--
nosy:  -hynek

___
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



[issue15104] Unclear language in __main__ description

2012-10-03 Thread Mike Hoy

Changes by Mike Hoy mho...@gmail.com:


--
nosy: +mikehoy

___
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



[issue15104] Unclear language in __main__ description

2012-10-01 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
keywords: +easy
versions: +Python 3.4

___
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



[issue15104] Unclear language in __main__ description

2012-06-23 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

As a native speaker, I agree that the sentence, in isolation, is hardly 
comprehensible. The previous one is also a bit flakey.

The situation is that top-level code executes in a module named __main__, which 
has one joint global/local namespace that is the global namespace for all 
subsidiary contexts. '__main__':__main__ module is added to sys.modules 
before user code is executed. The name __main__ is not normally in the __main__ 
(global) namespace, hence the comment about 'anonymous' in the first sentence. 
(It is not anonymous in sys.modules.) However (1) __main__ or any other 
module/namespace can 'import __main__' and get the reference to __main__ from 
sys.modules and (2) __main__ does have name __name__ bound to the *string* 
'__main__'. Hence a module can discover whether or not it *is* the __main__ 
module.

Part of the quoting confusion is that unquoted names in code become strings in 
namespace dicts, and hence quoted literals when referring to them as keys. What 
I did not realize until just now is that the __name__ attribute of a module 
*is* its name (key) in the module namespace (sys.modules dict). For instance, 
after 'import x.y' or 'from x import y', x.y.__name__ or y.__name is 'x.y' and 
that is its name (key) in sys.modules. So it appears that the __name__ of a 
package (sub)module is never just the filename (which I expected), and 
__name__ is the module name only if one considers the package name as part of 
the module name (which I did not).

The only non-capi reference to module.__name__ in the index is

3.2. The standard type hierarchy
Modules
__name__ is the module’s name

But what is the modules name? Its name in sys.modules, which is either __main__ 
or the full dotted name for modules in packages (as I just learned). Perhaps 
this could be explained better here.

--
nosy: +terry.reedy

___
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



[issue15104] Unclear language in __main__ description

2012-06-19 Thread R. David Murray

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



[issue15104] Unclear language in __main__ description

2012-06-19 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti
type:  - enhancement

___
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