Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Doc/c-api/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ Object Protocol

If *cls* has a :meth:`~type.__instancecheck__` method, it will be called to
determine the subclass status as described in :pep:`3119`. Otherwise, *inst*
is an instance of *cls* if its class is a subclass of *cls*.
is an instance of *cls* if its class is a subclass of *cls*. If *inst* is
an instance of *cls*, this will return ``1`` and will not call
:meth:`~type.__instancecheck__`.

An instance *inst* can override what is considered its class by having a
:attr:`~object.__class__` attribute.
Expand Down
6 changes: 5 additions & 1 deletion Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2965,7 +2965,11 @@ ABCs.

Return true if *instance* should be considered a (direct or indirect)
instance of *class*. If defined, called to implement ``isinstance(instance,
class)``.
cls)``.

.. note::
If ``type(instance) is cls`` then ``isinstance(instance, cls)`` is
always ``True`` and ``__instancecheck__`` is not called.


.. method:: type.__subclasscheck__(self, subclass)
Expand Down
Loading