You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Include the "object" type in the lists of documented types #60712
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:
assignee='https://github.com/cjerdonek'closed_at=Nonecreated_at=<Date2012-11-19.00:14:41.072>labels= ['type-feature', 'docs']
title='include the "object" type in the lists of documented types'updated_at=<Date2015-07-30.12:43:07.495>user='https://github.com/cjerdonek'
This issue is to add the "object" type to the list of types documented in the language reference's standard type hierarchy and the library reference's list of built-in types:
For example, object.__str__ is defined, but object.__bytes__ is not. By doing this, users will know which special methods user-defined classes will automatically inherit.
I think there was another issue discussing a separation between object.__str__ and someobject.__bytes__, to make it clear which are existing methods of the object class and which are methods that one may implement in their classes.
Doing this is going to be a bit tricky, since currently links like :meth:`object.__format__` go to the special methods section. So I think making the distinction between available special methods and ones that object implements will need to be done at the same time as this, and there may be quite a few places in the documentation where reference will need to be changed.
Here is a patch. Perhaps it is what you had in mind. I added quick mentions of the “object” class to The Standard Type Hierarchy and Other Built-in Types. I added documentation of what the object class’s own implementations do where it provides them. I added sentences pointing out that other methods are not provided by the object class, where I thought it may not already be clear. I also added a test case to check that various methods exist or not, to match the documentation.
changed the title [-]include the "object" type in the lists of documented types[/-][+]Include the "object" type in the lists of documented types[/+]on Mar 29, 2023
Activity
cjerdonek commentedon Nov 19, 2012
This issue is to add the "object" type to the list of types documented in the language reference's standard type hierarchy and the library reference's list of built-in types:
http://docs.python.org/dev/reference/datamodel.html#the-standard-type-hierarchy
http://docs.python.org/dev/library/stdtypes.html#other-built-in-types
The constructor is documented here:
http://docs.python.org/dev/library/functions.html#object
In the documentation, it might also be worth stating explicitly which of the special methods the object type defines:
http://docs.python.org/dev/reference/datamodel.html#special-method-names
For example, object.__str__ is defined, but object.__bytes__ is not. By doing this, users will know which special methods user-defined classes will automatically inherit.
terryjreedy commentedon Nov 23, 2012
good idea
merwok commentedon Mar 10, 2014
I think there was another issue discussing a separation between object.__str__ and someobject.__bytes__, to make it clear which are existing methods of the object class and which are methods that one may implement in their classes.
bitdancer commentedon Mar 12, 2014
Doing this is going to be a bit tricky, since currently links like :meth:`object.__format__` go to the special methods section. So I think making the distinction between available special methods and ones that object implements will need to be done at the same time as this, and there may be quite a few places in the documentation where reference will need to be changed.
terryjreedy commentedon Mar 12, 2014
What does not help is that help(ob) omits all the methods inherited from object, *even when ob is object*. See #64484.
vadmium commentedon Jul 30, 2015
Here is a patch. Perhaps it is what you had in mind. I added quick mentions of the “object” class to The Standard Type Hierarchy and Other Built-in Types. I added documentation of what the object class’s own implementations do where it provides them. I added sentences pointing out that other methods are not provided by the object class, where I thought it may not already be clear. I also added a test case to check that various methods exist or not, to match the documentation.
furkanonder commentedon Mar 29, 2023
The PR is ready for review.
[-]include the "object" type in the lists of documented types[/-][+]Include the "object" type in the lists of documented types[/+]gh-60712: Include the "object" type in the lists of documented types (G…
pythongh-60712: Include the "object" type in the lists of documented …
pythongh-60712: Include the "object" type in the lists of documented …
[3.12] gh-60712: Include the "object" type in the lists of documented…
[3.13] gh-60712: Include the "object" type in the lists of documented…
pythongh-60712: Include the "object" type in the lists of documented …
pythongh-60712: Include the "object" type in the lists of documented …
hugovk commentedon Feb 5, 2025
Triage: PR merged and backported. Please re-open if there's more to do.