-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-101100: fix sphinx warnings in reference/datamodel.rst #114280
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -885,7 +885,7 @@ Predefined (writable) attributes: | |
:attr:`__name__` | ||
The module's name. | ||
|
||
:attr:`__doc__` | ||
:attr:`~definition.__doc__` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to fix these warnings by creating a single canonical table in the datamodel docs, and removing duplicated documentation elsewhere: see #101100 (comment) (and see PRs where I did similar things for other lists like this in this document: #112781, #112735, #112832, #112933) |
||
The module's documentation string, or ``None`` if | ||
unavailable. | ||
|
||
|
@@ -976,7 +976,7 @@ Special attributes: | |
:attr:`~definition.__name__` | ||
The class name. | ||
|
||
:attr:`__module__` | ||
:attr:`~definition.__module__` | ||
The name of the module in which the class was defined. | ||
|
||
:attr:`~object.__dict__` | ||
|
@@ -986,7 +986,7 @@ Special attributes: | |
A tuple containing the base classes, in the order of | ||
their occurrence in the base class list. | ||
|
||
:attr:`__doc__` | ||
:attr:`~definition.__doc__` | ||
The class's documentation string, or ``None`` if undefined. | ||
|
||
:attr:`__annotations__` | ||
|
@@ -996,7 +996,7 @@ Special attributes: | |
working with :attr:`__annotations__`, please see | ||
:ref:`annotations-howto`. | ||
|
||
:attr:`__type_params__` | ||
:attr:`~definition.__type_params__` | ||
A tuple containing the :ref:`type parameters <type-params>` of | ||
a :ref:`generic class <generic-classes>`. | ||
|
||
|
@@ -1563,8 +1563,8 @@ When implementing a class that emulates any built-in type, it is important that | |
the emulation only be implemented to the degree that it makes sense for the | ||
object being modelled. For example, some sequences may work well with retrieval | ||
of individual elements, but extracting a slice may not make sense. (One example | ||
of this is the :class:`~xml.dom.NodeList` interface in the W3C's Document | ||
Object Model.) | ||
of this is the class ``NodeList`` interface in the W3C's Document | ||
Object Model, see :ref:`dom-nodelist-objects`.) | ||
|
||
|
||
.. _customization: | ||
|
@@ -2334,7 +2334,7 @@ class defining the method. | |
.. versionadded:: 3.6 | ||
|
||
|
||
When a class is created, :meth:`type.__new__` scans the class variables | ||
When a class is created, :meth:`!type.__new__` scans the class variables | ||
and makes callbacks to those with a :meth:`~object.__set_name__` hook. | ||
|
||
.. method:: object.__set_name__(self, owner, name) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, the attributes listed here should only be attributes such as
__dict__
and__class__
that appear on all Python objects (I'm aware that's not currently the case, but that's a problem, in my opinion).We already have a dedicated reference for the
__module__
attribute on function objects; I think we should do the same for the__module__
attribute on class objects: https://docs.python.org/3/reference/datamodel.html#function.__module__ (ditto for__doc__
)