New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not documented special names #67827
Comments
|
Here are lists of special names used in Python core and the stdlib, but absent in documentation index. Module level names used in pydoc: Module level name used in doctest: Other module level names: type attributes (mostly used in tests): super() attributes: Used in sqlite: Used in ctypes: Used in unittest: float methods, for testing: Used in IDLE RPC: Others: Needed a patch or a set of patches that will add theses names to the index and document them if they are not documented. |
|
I think most of these are either implementation details or "private" names, so there is no need to document them. The ones that are intended to be used by developers or that are useful to understand the functioning of a public API should be documented. If these names are already in the documentation but not in the index, then an index entry should be added. |
|
I think like Ezio does. Python covers itself by saying that all names starting and ending with two underscores are reserved, and documents those that are interesting for users. On the other hand, many third-party frameworks/libs/apps invent their own __names__ (often for metadata, sometimes for custom protocols); I don’t know if a full list of existing names in the doc would have dissuaded them. |
|
Some of these that I believe are at least partially documented, so could be added to the index. But the index for these is not very good anyway, because they are listed in a funny (ASCII-betical?) order in a special section called “symbols”, rather than alphabetically as you would expect. But that would be a separate issue. Potential index entries: builtins.__build_class__() → https://docs.python.org/dev/library/dis.html#opcode-LOAD_BUILD_CLASS Others that are referenced by the documentation, but not explained anywhere that I can tell:
Regarding __base__, I always assumed this was a leftover from Python 2 from some time before multiple inheritance, so maybe __bases__ could be used instead now (unless testing backwards compatibility). |
|
Idlelib.rpc uses the somewhat arbitrary *strings* '__methods__' and '__attributes__' as private signals in its protocol. They are not object or attribute names, special or otherwise, in the sense used here. The use of '__methods__' in idlelib.rpc (line 176) harkens back to pre 2.2 days when __methods__ was officially used in the type introspection api. That class attribute was "a list of method names supported by the object.". See PEP-252. Its complement was __members__, a list of non-method attributes (other than itself, I presume). rpc uses '__attributes__' instead. |
|
index-special.patch is a patch that adds index entries to the existing documentation that I found above. |
Also, we want to be careful to not guarantee implementation details that are subject to change. Most of these are not intended for users to base their code on. IIRC, Guido already opined on some of these (preferring to keep most of them undocumented) in some other tracker item this year. As one data point, I worked on the decimal module and defined the public API. The __decimal_context__ method is not part of the public API. |
|
See also: |
|
Question is, which ones are supposed to be private and which ones aren't? |
serhiy-storchaka commentedMar 11, 2015
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: