Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95693

Re: isinstance() and multiple inheritance/ctypes

References <mrlalj$nlt$1@dont-email.me> <CAPTjJmrrFT3aE3vF8nZiw0uxWGCw18YyEFXvOPCtdQDRxiOY7Q@mail.gmail.com> <mailman.68.1440630846.11709.python-list@python.org> <55df099e$0$1638$c3e8da3$5496439d@news.astraweb.com>
Date 2015-08-28 00:33 +1000
Subject Re: isinstance() and multiple inheritance/ctypes
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.75.1440686010.11709.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Aug 27, 2015 at 10:59 PM, Steven D'Aprano <steve@pearwood.info> wrote:
> On Thu, 27 Aug 2015 09:14 am, Chris Angelico wrote:
>
>> On Thu, Aug 27, 2015 at 9:12 AM, Chris Angelico <rosuav@gmail.com> wrote:
>>> Or is there a magic __isinstance__
>>
>> Argh, keyed the wrong thing and sent the post prematurely. Meant to say:
>>
>> Or is there a magic __instancecheck__ method somewhere that I'm not aware
>> of?
>
> Yes -- see Terry Reedy's post.
>
> isinstance(inst, klass) ends up calling
>
> type(klass).__instancecheck__(klass, inst)

I'm aware that it _can_ exist, but I was asking if one _did_ exist.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

isinstance() and multiple inheritance/ctypes Rob Gaddi <rgaddi@technologyhighland.invalid> - 2015-08-26 21:21 +0000
  Re: isinstance() and multiple inheritance/ctypes Terry Reedy <tjreedy@udel.edu> - 2015-08-26 17:46 -0400
  Re: isinstance() and multiple inheritance/ctypes Chris Angelico <rosuav@gmail.com> - 2015-08-27 09:12 +1000
    Re: isinstance() and multiple inheritance/ctypes Rob Gaddi <rgaddi@technologyhighland.invalid> - 2015-08-26 23:42 +0000
  Re: isinstance() and multiple inheritance/ctypes Chris Angelico <rosuav@gmail.com> - 2015-08-27 09:14 +1000
    Re: isinstance() and multiple inheritance/ctypes Steven D'Aprano <steve@pearwood.info> - 2015-08-27 22:59 +1000
      Re: isinstance() and multiple inheritance/ctypes Chris Angelico <rosuav@gmail.com> - 2015-08-28 00:33 +1000
        Re: isinstance() and multiple inheritance/ctypes Steven D'Aprano <steve@pearwood.info> - 2015-08-28 13:02 +1000
          Re: isinstance() and multiple inheritance/ctypes Chris Angelico <rosuav@gmail.com> - 2015-08-28 13:25 +1000

csiph-web