Title: issubclass doc improvement
Type: enhancement Stage:
Components: Documentation Versions: Python 3.3, Python 3.4
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, ezio.melotti, fossilet
Priority: normal Keywords:

Created on 2012-11-08 14:04 by fossilet, last changed 2012-11-08 23:46 by ezio.melotti.

Messages (2)
msg175158 - (view) Author: Yongzhi Pan (fossilet) * Date: 2012-11-08 14:04

"classinfo may be a tuple of class objects."

I suggest make it clear like isinstance, use something like this:

classinfo may be a tuple of class objects and such tuples.
msg175208 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-11-08 23:46
While this is documented for isinstance, I'm not sure it should be advertised too much, as it seems to me an implementation detail and doesn't seem too useful in practice.

This is a side-effect of the fact that
  isinstance(x, (A, B, ...))
is equivalent to
  isinstance(x, A) or isinstance(x, B) or ...
and therefore
  isinstance(x, (A, (B, C)))
is equivalent to
  isinstance(x, A) or isinstance(x, (B, C))
which in turn is equivalent to
  isinstance(x, A) or (isinstance(x, B) or isinstance(x, C))

While this behavior seems intentional [0], it doesn't seem to be tested [1].  FTR this is supported by PyPy too.

Date User Action Args
2012-11-08 23:46:28ezio.melottisettype: enhancement

messages: + msg175208
nosy: + ezio.melotti
2012-11-08 14:04:40fossiletcreate