[Python-ideas] Fix documentation for __instancecheck__

Chris Angelico rosuav at gmail.com
Sat Oct 27 20:08:48 EDT 2018


On Sun, Oct 28, 2018 at 11:02 AM Steven D'Aprano <steve at pearwood.info> wrote:
> > """
> > (Note that any object `x` is always considered to be an instance of
> > `x.__class__`, and this cannot be overridden.)
> > """
>
> I would rather be precise about what is going on, and state that
> X.__instancecheck__(x) is not called if type(x) is X, rather than merely
> imply it. It is not just that the method is called and ignored, but
> that it isn't called at all.

Are there any situations where something is called and ignored, such
that the distinction needs to be drawn?

Not a rhetorical question. I have no idea what dark corners there are
(like the difference between __class__ and type(), which you also are
unsure of).

ChrisA


More information about the Python-ideas mailing list