This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients Michael Crouch, docs@python, eryksun, r.david.murray
Date 2015-10-17.17:25:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1445102721.74.0.669873112683.issue25432@psf.upfronthosting.co.za>
In-reply-to
Content
Since Python has multiple inheritance, it could be misconstrued as a conjunctive test. For example, if c is an instance of C, which subclasses both A and B, then someone might think isinstance(c, (A, B)) requires c to be an instance of both A and B. The description could clarify that it's a disjunctive test with short circuiting.

    class MetaA(type):
        def __instancecheck__(self, other):
            print('MetaA.__instancecheck__')
            return False

    class A(metaclass=MetaA): pass

    >>> isinstance(1, (A, int))
    MetaA.__instancecheck__
    True
    >>> isinstance(1, (int, A))
    True
History
Date User Action Args
2015-10-17 17:25:21eryksunsetrecipients: + eryksun, r.david.murray, docs@python, Michael Crouch
2015-10-17 17:25:21eryksunsetmessageid: <1445102721.74.0.669873112683.issue25432@psf.upfronthosting.co.za>
2015-10-17 17:25:21eryksunlinkissue25432 messages
2015-10-17 17:25:21eryksuncreate