[docs] [issue25432] isinstance documentation: explain behavior when type is a tuple

Terry J. Reedy report at bugs.python.org
Mon Oct 26 18:13:14 EDT 2015


Terry J. Reedy added the comment:

David, if you are suggesting that the initial negative clause of "If classinfo is not a class (type object)" is not needed, I agree.  If classinfo is a tuple, is is not a class.  'list of types' has to be 'tuple of types'. I think 'match' needs to be expanded to 'is an instance of'. How about

"If classinfo is a tuple of type objects (or recursively, other such tuples), return true if object is an instance of any of the types.

This leaves out the left to right ordering of the tests, but I think that is implied by how Python generally works.  Short circuiting certainly is.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25432>
_______________________________________


More information about the docs mailing list