mirror of https://github.com/python/cpython
gh-120572: add missing parentheses in TypeIs documentation (#120573)
This commit is contained in:
parent
08d09cf5ba
commit
1fa595963e
|
@ -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…
Reference in New Issue