Path: csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.astraweb.com!border5.newsrouter.astraweb.com!not-for-mail Message-Id: <55dfcf4e$0$1663$c3e8da3$5496439d@news.astraweb.com> From: Steven D'Aprano Subject: Re: isinstance() and multiple inheritance/ctypes Newsgroups: comp.lang.python Date: Fri, 28 Aug 2015 13:02:39 +1000 References: <55df099e$0$1638$c3e8da3$5496439d@news.astraweb.com> User-Agent: KNode/0.10.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Lines: 37 Organization: Unlimited download news at news.astraweb.com NNTP-Posting-Host: 314e3172.news.astraweb.com X-Trace: DXC=3lTK7B44@7lTSR1JO8jBlmL?0kYOcDh@j=GNSRN<\Iha\>T:^Al174hHI6bY5_;LhiEBe]G`V^KXg4aA0:0=W?Wk]8DnFQMcO\i Xref: csiph.com comp.lang.python:95715 On Fri, 28 Aug 2015 12:33 am, Chris Angelico wrote: > On Thu, Aug 27, 2015 at 10:59 PM, Steven D'Aprano > wrote: >> On Thu, 27 Aug 2015 09:14 am, Chris Angelico wrote: >> >>> On Thu, Aug 27, 2015 at 9:12 AM, Chris Angelico >>> 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__ What am I missing? -- Steven