Skip to content

Commit

Permalink
Fix RST markup in type_narrowing.rst (#14253)
Browse files Browse the repository at this point in the history
Switch :py:func:type to py:class:type in type_narrowing.rst. The former does not render properly in the docs

This is a tiny follow up from
#14246 (comment)
  • Loading branch information
LefterisJP authored Dec 20, 2022
1 parent f7ed65b commit cb1d1a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/source/type_narrowing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The simplest way to narrow a type is to use one of the supported expressions:

- :py:func:`isinstance` like in ``isinstance(obj, float)`` will narrow ``obj`` to have ``float`` type
- :py:func:`issubclass` like in ``issubclass(cls, MyClass)`` will narrow ``cls`` to be ``Type[MyClass]``
- :py:func:`type` like in ``type(obj) is int`` will narrow ``obj`` to have ``int`` type
- :py:class:`type` like in ``type(obj) is int`` will narrow ``obj`` to have ``int`` type
- :py:func:`callable` like in ``callable(obj)`` will narrow object to callable type

Type narrowing is contextual. For example, based on the condition, mypy will narrow an expression only within an ``if`` branch:
Expand Down

0 comments on commit cb1d1a0

Please sign in to comment.