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


Groups > comp.lang.python > #95715

Re: isinstance() and multiple inheritance/ctypes

Message-Id <55dfcf4e$0$1663$c3e8da3$5496439d@news.astraweb.com>
From Steven D'Aprano <steve@pearwood.info>
Subject Re: isinstance() and multiple inheritance/ctypes
Newsgroups comp.lang.python
Date 2015-08-28 13:02 +1000
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> <mailman.75.1440686010.11709.python-list@python.org>
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


On Fri, 28 Aug 2015 12:33 am, Chris Angelico wrote:

> 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.


Er, I'm still not getting you. Of course one exists, otherwise isinstance
would end up raising an exception. 

py> type.__instancecheck__
<method '__instancecheck__' of 'type' objects>

What am I missing?



-- 
Steven

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