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.

classification
Title: Improve __spec__ discoverability
Type: Stage: resolved
Components: Documentation Versions: Python 3.7, Python 3.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: barry Nosy List: barry
Priority: normal Keywords: patch

Created on 2017-10-16 14:16 by barry, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 4010 merged barry, 2017-10-16 14:46
PR 4021 merged python-dev, 2017-10-17 19:53
Messages (3)
msg304474 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2017-10-16 14:16
__spec__ is defined in PEP 451.  If you search for "__spec__" in the docs, you get a number of hits.

https://docs.python.org/3/search.html?q=__spec__&check_keywords=yes&area=default

Click on the first link:

https://docs.python.org/3/reference/import.html?highlight=__spec__#__spec__

but that still leaves you scratching your head as to what exactly is in __spec__.  If you happen to scroll up a little bit though, you end up here:

https://docs.python.org/3/reference/import.html?highlight=__spec__#module-spec

and then if you follow the link to ModuleSpec, you finally get to here:

https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec

and *that's* where the contents of __spec__ are defined.  Not very discoverable.

I propose just a couple of small documentation fixes to add "__spec__" in both of those locations so that a search lands you in a useful place.
msg304522 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2017-10-17 19:52
New changeset 191e3138200906e43cba9347177914325b54843f by Barry Warsaw in branch 'master':
bpo-31799: Make module.__spec__ more discoverable (#4010)
https://github.com/python/cpython/commit/191e3138200906e43cba9347177914325b54843f
msg304524 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2017-10-17 19:59
New changeset 858ea4354fafa36e57859d2dfd70f8a057984075 by Barry Warsaw (Miss Islington (bot)) in branch '3.6':
[3.6] bpo-31799: Make module.__spec__ more discoverable (GH-4010) (#4021)
https://github.com/python/cpython/commit/858ea4354fafa36e57859d2dfd70f8a057984075
History
Date User Action Args
2022-04-11 14:58:53adminsetgithub: 75980
2017-10-17 19:59:55barrysetstatus: open -> closed
stage: patch review -> resolved
versions: - Python 3.4, Python 3.5
2017-10-17 19:59:23barrysetmessages: + msg304524
2017-10-17 19:53:47python-devsetpull_requests: + pull_request3996
2017-10-17 19:52:40barrysetmessages: + msg304522
2017-10-16 14:46:58barrysetkeywords: + patch
stage: patch review
pull_requests: + pull_request3984
2017-10-16 14:16:27barrycreate