[New-bugs-announce] [issue25912] Use __spec__.__name__ instead of __name__ in the docs where appropriate

Antony Lee report at bugs.python.org
Sat Dec 19 17:39:00 EST 2015


New submission from Antony Lee:

There are a couple of places in the docs where it would be appropriate to replace __name__ by __spec__.__name__ in order to support the case where the module is executed as the __main__ module:

- logging.getLogger should certainly use __spec__.__name__ so that the logger hierarchy be respected (otherwise, when running "python -mpkg.subpkg", the logger of pkg.subpkg is named "__main__" and thus not a child of the "pkg" logger).

- examples for argparse.ArgumentParser (e.g. in the docs for venv) should use __spec__.__name__ instead of __name__ for the "prog=" argument.

(not guaranteed to be exhaustive)

----------
assignee: docs at python
components: Documentation
messages: 256743
nosy: Antony.Lee, docs at python
priority: normal
severity: normal
status: open
title: Use __spec__.__name__ instead of __name__ in the docs where appropriate
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25912>
_______________________________________


More information about the New-bugs-announce mailing list