Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d6bde6

Browse files
(docs) Update common_issues.rst: document how the type ignore must come first (#20886)
#19366 won't be fixed/changed any time soon, but this constraint should be noted to the end user.
1 parent 6484430 commit 5d6bde6

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

docs/source/common_issues.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ error:
148148
The second line is now fine, since the ignore comment causes the name
149149
``frobnicate`` to get an implicit ``Any`` type.
150150

151+
The type ignore comment must be at the start of the comments on a line.
152+
This type ignore will not take effect:
153+
154+
.. code-block:: python
155+
156+
import frobnicate #example other comment # type: ignore
157+
frobnicate.start()
158+
151159
.. note::
152160

153161
You can use the form ``# type: ignore[<code>]`` to only ignore

0 commit comments

Comments
 (0)