mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.13] gh-120572: add missing parentheses in TypeIs documentation (GH-120573) (#120575)
gh-120572: add missing parentheses in TypeIs documentation (GH-120573)
(cherry picked from commit 1fa595963e
)
Co-authored-by: Nyuan Zhang <blueglassblock@outlook.com>
This commit is contained in:
parent
a19bb261a3
commit
d4e1d093d8
1 changed files with 2 additions and 2 deletions
|
@ -1454,8 +1454,8 @@ These can be used as types in annotations. They all support subscription using
|
||||||
to write such functions in a type-safe manner.
|
to write such functions in a type-safe manner.
|
||||||
|
|
||||||
If a ``TypeIs`` function is a class or instance method, then the type in
|
If a ``TypeIs`` function is a class or instance method, then the type in
|
||||||
``TypeIs`` maps to the type of the second parameter after ``cls`` or
|
``TypeIs`` maps to the type of the second parameter (after ``cls`` or
|
||||||
``self``.
|
``self``).
|
||||||
|
|
||||||
In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``,
|
In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``,
|
||||||
means that if ``foo(arg)`` returns ``True``, then ``arg`` is an instance
|
means that if ``foo(arg)`` returns ``True``, then ``arg`` is an instance
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue