-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Crossreferences to standard library in mypy docs, part 2 #7660
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
Conversation
@@ -254,8 +254,8 @@ For more information, see the :ref:`None and optional handling <none-and-optiona | |||
section of the command line docs. | |||
|
|||
``no_implicit_optional`` (bool, default False) | |||
Changes the treatment of arguments with a default value of None by not implicitly | |||
making their type Optional. | |||
Changes the treatment of arguments with a default value of ``None`` by not implicitly |
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.
I suppose the verbatim formatting was forgotten here, so added the Optional
ref as well.
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.
+1
A comma-separated list of paths which should be checked by mypy if none are given on the command | ||
line. Supports recursive file globbing using :doc:`library/glob`, where ``*`` (e.g. ``*.py``) matches | ||
line. Supports recursive file globbing using :py:mod:`glob`, where ``*`` (e.g. ``*.py``) matches |
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.
Please advise here. Both links lead to the same target: the glob
module docs, but are rendered differently:
vs
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.
I like the second better. So +1 to the change. (Do we use this :doc:
style elsewhere, and does it get rendered so longwindedly there too? I think it's not needed.)
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.
There are a few :doc:
roles that refer to standard library modules:
mypy/docs/source/additional_features.rst
Line 69 in c95ecc1
For more information see :doc:`official docs <python:library/dataclasses>` |
mypy/docs/source/class_basics.rst
Line 235 in c95ecc1
Mypy supports Python :doc:`abstract base classes <library/abc>` (ABCs). Abstract classes |
mypy/docs/source/config_file.rst
Line 32 in c95ecc1
:doc:`ini file <python:library/configparser>` format. It should contain |
mypy/docs/source/error_code_list.rst
Lines 545 to 546 in c95ecc1
abstract method or attribute. (See also :doc:`Python | |
abc module documentation <python:library/abc>`) |
Do you suggest to replace them with the appropriate :mod:
role?
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.
It doesn't seem necessary, since those other places all specify link text.
We cannot hope to strive for 100% consistency everywhere.
You can use ``cast()`` (see chapter :ref:`casts`) or ``isinstance`` to | ||
go from a general type such as ``object`` to a more specific | ||
type (subtype) such as ``int``. ``cast()`` is not needed with | ||
You can use :py:func:`~typing.cast` (see chapter :ref:`casts`) or :py:func:`isinstance` to |
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.
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.
+1. The only time it's better not to add ()
to a function is when we're talking about the function object (e.g. in the context of creating an alias or accessing attributes).
Signed-off-by: Oleg Höfling <[email protected]>
Signed-off-by: Oleg Höfling <[email protected]>
Signed-off-by: Oleg Höfling <[email protected]>
01c55cd
to
943f159
Compare
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.
Will merge as-is.
@@ -254,8 +254,8 @@ For more information, see the :ref:`None and optional handling <none-and-optiona | |||
section of the command line docs. | |||
|
|||
``no_implicit_optional`` (bool, default False) | |||
Changes the treatment of arguments with a default value of None by not implicitly | |||
making their type Optional. | |||
Changes the treatment of arguments with a default value of ``None`` by not implicitly |
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.
+1
A comma-separated list of paths which should be checked by mypy if none are given on the command | ||
line. Supports recursive file globbing using :doc:`library/glob`, where ``*`` (e.g. ``*.py``) matches | ||
line. Supports recursive file globbing using :py:mod:`glob`, where ``*`` (e.g. ``*.py``) matches |
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.
I like the second better. So +1 to the change. (Do we use this :doc:
style elsewhere, and does it get rendered so longwindedly there too? I think it's not needed.)
You can use ``cast()`` (see chapter :ref:`casts`) or ``isinstance`` to | ||
go from a general type such as ``object`` to a more specific | ||
type (subtype) such as ``int``. ``cast()`` is not needed with | ||
You can use :py:func:`~typing.cast` (see chapter :ref:`casts`) or :py:func:`isinstance` to |
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.
+1. The only time it's better not to add ()
to a function is when we're talking about the function object (e.g. in the context of creating an alias or accessing attributes).
Added references to the following documents:
builtin_types.rst
common_issues.rst
config_file.rst
dynamic_typing.rst
This is part of splitting up the changes in #7624 into more readable PRs.