-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Include the "object" type in the lists of documented types #60712
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
Comments
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 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. |
good idea |
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. |
What does not help is that help(ob) omits all the methods inherited from object, *even when ob is object*. See #64484. |
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. |
The PR is ready for review. |
…H-103036) * add test for the predefined object's attributes * Include the "object" type in the lists of documented types * remove 'or' from augment tuple * 📜🤖 Added by blurb_it. * Add cross-reference to news Co-authored-by: C.A.M. Gerlach <[email protected]> * Fix format for the function parameter Co-authored-by: C.A.M. Gerlach <[email protected]> * Add space Co-authored-by: C.A.M. Gerlach <[email protected]> * add reference for the 'object' Co-authored-by: C.A.M. Gerlach <[email protected]> * add reference for NotImplemented Co-authored-by: C.A.M. Gerlach <[email protected]> * Change ref:`string <textseq>` as class:`str` Co-authored-by: C.A.M. Gerlach <[email protected]> * remove hyphen from `newly-created` * Update Doc/reference/datamodel.rst 'dictionaries' to 'dict' Co-authored-by: C.A.M. Gerlach <[email protected]> * Update predefined attribute types in testPredefinedAttrs * Change `universal type` as `top type` * Don't mention about the top type * Update the description of richcmpfuncs * Update Doc/library/stdtypes.rst Co-authored-by: Éric <[email protected]> * Revert: Hierarchy Section in Data Model Documentation * Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity. * Update Doc/reference/datamodel.rst Co-authored-by: Éric <[email protected]> * Remove blank line Co-authored-by: Éric <[email protected]> * Use ref:`str <textseq>` instead of :class:`str Co-authored-by: Éric <[email protected]> * Revert changes the description of Other Built-in Types in stdtypes.rst * Update Doc/reference/datamodel.rst Co-authored-by: Éric <[email protected]> --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: C.A.M. Gerlach <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]> Co-authored-by: Éric <[email protected]> Co-authored-by: Carol Willing <[email protected]>
…types (pythonGH-103036) * add test for the predefined object's attributes * Include the "object" type in the lists of documented types * remove 'or' from augment tuple * 📜🤖 Added by blurb_it. * Add cross-reference to news Co-authored-by: C.A.M. Gerlach <[email protected]> * Fix format for the function parameter Co-authored-by: C.A.M. Gerlach <[email protected]> * Add space Co-authored-by: C.A.M. Gerlach <[email protected]> * add reference for the 'object' Co-authored-by: C.A.M. Gerlach <[email protected]> * add reference for NotImplemented Co-authored-by: C.A.M. Gerlach <[email protected]> * Change ref:`string <textseq>` as class:`str` Co-authored-by: C.A.M. Gerlach <[email protected]> * remove hyphen from `newly-created` * Update Doc/reference/datamodel.rst 'dictionaries' to 'dict' Co-authored-by: C.A.M. Gerlach <[email protected]> * Update predefined attribute types in testPredefinedAttrs * Change `universal type` as `top type` * Don't mention about the top type * Update the description of richcmpfuncs * Update Doc/library/stdtypes.rst Co-authored-by: Éric <[email protected]> * Revert: Hierarchy Section in Data Model Documentation * Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity. * Update Doc/reference/datamodel.rst Co-authored-by: Éric <[email protected]> * Remove blank line Co-authored-by: Éric <[email protected]> * Use ref:`str <textseq>` instead of :class:`str Co-authored-by: Éric <[email protected]> * Revert changes the description of Other Built-in Types in stdtypes.rst * Update Doc/reference/datamodel.rst Co-authored-by: Éric <[email protected]> --------- (cherry picked from commit 4f82621) Co-authored-by: Furkan Onder <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: C.A.M. Gerlach <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]> Co-authored-by: Éric <[email protected]> Co-authored-by: Carol Willing <[email protected]>
…types (pythonGH-103036) * add test for the predefined object's attributes * Include the "object" type in the lists of documented types * remove 'or' from augment tuple * 📜🤖 Added by blurb_it. * Add cross-reference to news Co-authored-by: C.A.M. Gerlach <[email protected]> * Fix format for the function parameter Co-authored-by: C.A.M. Gerlach <[email protected]> * Add space Co-authored-by: C.A.M. Gerlach <[email protected]> * add reference for the 'object' Co-authored-by: C.A.M. Gerlach <[email protected]> * add reference for NotImplemented Co-authored-by: C.A.M. Gerlach <[email protected]> * Change ref:`string <textseq>` as class:`str` Co-authored-by: C.A.M. Gerlach <[email protected]> * remove hyphen from `newly-created` * Update Doc/reference/datamodel.rst 'dictionaries' to 'dict' Co-authored-by: C.A.M. Gerlach <[email protected]> * Update predefined attribute types in testPredefinedAttrs * Change `universal type` as `top type` * Don't mention about the top type * Update the description of richcmpfuncs * Update Doc/library/stdtypes.rst Co-authored-by: Éric <[email protected]> * Revert: Hierarchy Section in Data Model Documentation * Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity. * Update Doc/reference/datamodel.rst Co-authored-by: Éric <[email protected]> * Remove blank line Co-authored-by: Éric <[email protected]> * Use ref:`str <textseq>` instead of :class:`str Co-authored-by: Éric <[email protected]> * Revert changes the description of Other Built-in Types in stdtypes.rst * Update Doc/reference/datamodel.rst Co-authored-by: Éric <[email protected]> --------- (cherry picked from commit 4f82621) Co-authored-by: Furkan Onder <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: C.A.M. Gerlach <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]> Co-authored-by: Éric <[email protected]> Co-authored-by: Carol Willing <[email protected]>
… types (GH-103036) (GH-126198) gh-60712: Include the "object" type in the lists of documented types (GH-103036) * add test for the predefined object's attributes * Include the "object" type in the lists of documented types * remove 'or' from augment tuple * 📜🤖 Added by blurb_it. * Add cross-reference to news * Fix format for the function parameter * Add space * add reference for the 'object' * add reference for NotImplemented * Change ref:`string <textseq>` as class:`str` * remove hyphen from `newly-created` * Update Doc/reference/datamodel.rst 'dictionaries' to 'dict' * Update predefined attribute types in testPredefinedAttrs * Change `universal type` as `top type` * Don't mention about the top type * Update the description of richcmpfuncs * Update Doc/library/stdtypes.rst * Revert: Hierarchy Section in Data Model Documentation * Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity. * Update Doc/reference/datamodel.rst * Remove blank line * Use ref:`str <textseq>` instead of :class:`str * Revert changes the description of Other Built-in Types in stdtypes.rst * Update Doc/reference/datamodel.rst --------- (cherry picked from commit 4f82621) Co-authored-by: Furkan Onder <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: C.A.M. Gerlach <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]> Co-authored-by: Éric <[email protected]> Co-authored-by: Carol Willing <[email protected]>
… types (GH-103036) (GH-126197) gh-60712: Include the "object" type in the lists of documented types (GH-103036) * add test for the predefined object's attributes * Include the "object" type in the lists of documented types * remove 'or' from augment tuple * 📜🤖 Added by blurb_it. * Add cross-reference to news * Fix format for the function parameter * Add space * add reference for the 'object' * add reference for NotImplemented * Change ref:`string <textseq>` as class:`str` * remove hyphen from `newly-created` * Update Doc/reference/datamodel.rst 'dictionaries' to 'dict' * Update predefined attribute types in testPredefinedAttrs * Change `universal type` as `top type` * Don't mention about the top type * Update the description of richcmpfuncs * Update Doc/library/stdtypes.rst * Revert: Hierarchy Section in Data Model Documentation * Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity. * Update Doc/reference/datamodel.rst * Remove blank line * Use ref:`str <textseq>` instead of :class:`str * Revert changes the description of Other Built-in Types in stdtypes.rst * Update Doc/reference/datamodel.rst --------- (cherry picked from commit 4f82621) Co-authored-by: Furkan Onder <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: C.A.M. Gerlach <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]> Co-authored-by: Éric <[email protected]> Co-authored-by: Carol Willing <[email protected]>
…types (pythonGH-103036) * add test for the predefined object's attributes * Include the "object" type in the lists of documented types * remove 'or' from augment tuple * 📜🤖 Added by blurb_it. * Add cross-reference to news Co-authored-by: C.A.M. Gerlach <[email protected]> * Fix format for the function parameter Co-authored-by: C.A.M. Gerlach <[email protected]> * Add space Co-authored-by: C.A.M. Gerlach <[email protected]> * add reference for the 'object' Co-authored-by: C.A.M. Gerlach <[email protected]> * add reference for NotImplemented Co-authored-by: C.A.M. Gerlach <[email protected]> * Change ref:`string <textseq>` as class:`str` Co-authored-by: C.A.M. Gerlach <[email protected]> * remove hyphen from `newly-created` * Update Doc/reference/datamodel.rst 'dictionaries' to 'dict' Co-authored-by: C.A.M. Gerlach <[email protected]> * Update predefined attribute types in testPredefinedAttrs * Change `universal type` as `top type` * Don't mention about the top type * Update the description of richcmpfuncs * Update Doc/library/stdtypes.rst Co-authored-by: Éric <[email protected]> * Revert: Hierarchy Section in Data Model Documentation * Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity. * Update Doc/reference/datamodel.rst Co-authored-by: Éric <[email protected]> * Remove blank line Co-authored-by: Éric <[email protected]> * Use ref:`str <textseq>` instead of :class:`str Co-authored-by: Éric <[email protected]> * Revert changes the description of Other Built-in Types in stdtypes.rst * Update Doc/reference/datamodel.rst Co-authored-by: Éric <[email protected]> --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: C.A.M. Gerlach <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]> Co-authored-by: Éric <[email protected]> Co-authored-by: Carol Willing <[email protected]>
…types (pythonGH-103036) * add test for the predefined object's attributes * Include the "object" type in the lists of documented types * remove 'or' from augment tuple * 📜🤖 Added by blurb_it. * Add cross-reference to news Co-authored-by: C.A.M. Gerlach <[email protected]> * Fix format for the function parameter Co-authored-by: C.A.M. Gerlach <[email protected]> * Add space Co-authored-by: C.A.M. Gerlach <[email protected]> * add reference for the 'object' Co-authored-by: C.A.M. Gerlach <[email protected]> * add reference for NotImplemented Co-authored-by: C.A.M. Gerlach <[email protected]> * Change ref:`string <textseq>` as class:`str` Co-authored-by: C.A.M. Gerlach <[email protected]> * remove hyphen from `newly-created` * Update Doc/reference/datamodel.rst 'dictionaries' to 'dict' Co-authored-by: C.A.M. Gerlach <[email protected]> * Update predefined attribute types in testPredefinedAttrs * Change `universal type` as `top type` * Don't mention about the top type * Update the description of richcmpfuncs * Update Doc/library/stdtypes.rst Co-authored-by: Éric <[email protected]> * Revert: Hierarchy Section in Data Model Documentation * Revert to original explanations of __new__ and __init__ methods in datamodel.rst for improved clarity. * Update Doc/reference/datamodel.rst Co-authored-by: Éric <[email protected]> * Remove blank line Co-authored-by: Éric <[email protected]> * Use ref:`str <textseq>` instead of :class:`str Co-authored-by: Éric <[email protected]> * Revert changes the description of Other Built-in Types in stdtypes.rst * Update Doc/reference/datamodel.rst Co-authored-by: Éric <[email protected]> --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: C.A.M. Gerlach <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]> Co-authored-by: Éric <[email protected]> Co-authored-by: Carol Willing <[email protected]>
Triage: PR merged and backported. Please re-open if there's more to do. |
Uh oh!
There was an error while loading. Please reload this page.
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:
Linked PRs
The text was updated successfully, but these errors were encountered: