Skip to content

Commit bc8102c

Browse files
committed
Update documentation to describe type(instance) is cls edge case of __instancecheck__
1 parent e84a2cc commit bc8102c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Doc/reference/datamodel.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2965,7 +2965,11 @@ ABCs.
29652965

29662966
Return true if *instance* should be considered a (direct or indirect)
29672967
instance of *class*. If defined, called to implement ``isinstance(instance,
2968-
class)``.
2968+
cls)``.
2969+
2970+
.. note::
2971+
If ``type(instance) is cls`` then ``isinstance(instance, cls)`` is
2972+
always ``True`` and ``__instancecheck__`` is not called.
29692973

29702974

29712975
.. method:: type.__subclasscheck__(self, subclass)

0 commit comments

Comments
 (0)