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@python
components: Documentation
messages: 256743
nosy: Antony.Lee, docs@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