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


Groups > comp.lang.python > #95716

Re: isinstance() and multiple inheritance/ctypes

Path csiph.com!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'modified': 0.05; 'exception.': 0.07; 'exist,': 0.07; 'cc:addr:python-list': 0.09; 'exist.': 0.09; 'keyed': 0.09; 'subject:ctypes': 0.09; 'thu,': 0.15; '10:59': 0.16; 'argh,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'magic': 0.16; 'missing?': 0.16; 'normal,': 0.16; 'to:addr:pearwood.info': 0.16; "to:name:steven d'aprano": 0.16; 'wrote:': 0.16; "shouldn't": 0.18; '>>>': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'meant': 0.22; 'are.': 0.22; 'trying': 0.22; 'am,': 0.23; 'somewhere': 0.24; 'header:In-Reply-To:1': 0.24; 'chris': 0.26; 'figure': 0.27; 'define': 0.27; 'fri,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'exists,': 0.29; "i'm": 0.30; 'subject:/': 0.30; 'certain': 0.31; 'post': 0.31; 'skip:_ 10': 0.32; 'getting': 0.33; "d'aprano": 0.33; 'is?': 0.33; 'raising': 0.33; 'steven': 0.33; 'received:google.com': 0.35; 'instance': 0.35; 'asking': 0.35; 'but': 0.36; 'list,': 0.36; 'there': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'method': 0.37; 'wrong': 0.38; 'hi,': 0.38; 'end': 0.39; 'why': 0.39; 'does': 0.39; 'still': 0.40; 'default': 0.61; 'yes': 0.62; 'course': 0.62; 'you.': 0.64; '>>>>>': 0.66; 'chrisa': 0.84; 'of?': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Y9jat9Z3xljjvTqf37I6tqxe9R/6g7Wj3dR+epF5bJk=; b=mcT6glsvDd/rdWxPbK0nMduxTQZ1uN6VOL3UzRIyHEnssHSu3BCCz5hC3PBeBHssii 9nHOM2HUVPUTAHoEDzBoQRLO1b1syHxX1G7lsuI7ySS4o/SrtcwLqRn//3wQrR2YYycB 5mPT2WYZVUtEzRsj4mVpV5OWQf6jvh2lebyJjbNMbo9JF5Hkm4pjrVrS6hNYSK1k7F6H fKHWT/luwDzFlBotoWtlPEuHgj5G6oz867adM6iR7BtRu5pSy7X2puuDJxJdAETrh/9F 1luy3e5uRFI/NlXpHa64+NK6zevUfRJZeRkniaMOhPB4p6dnyyTHlQB742N/ZJ2XfPtc ssHQ==
MIME-Version 1.0
X-Received by 10.50.21.10 with SMTP id r10mr1710621ige.94.1440732348661; Thu, 27 Aug 2015 20:25:48 -0700 (PDT)
In-Reply-To <55dfcf4e$0$1663$c3e8da3$5496439d@news.astraweb.com>
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> <55dfcf4e$0$1663$c3e8da3$5496439d@news.astraweb.com>
Date Fri, 28 Aug 2015 13:25:48 +1000
Subject Re: isinstance() and multiple inheritance/ctypes
From Chris Angelico <rosuav@gmail.com>
To "Steven D'Aprano" <steve@pearwood.info>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.95.1440732351.11709.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1440732351 news.xs4all.nl 23743 [2001:888:2000:d::a6]:54950
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95716

Show key headers only | View raw


On Fri, Aug 28, 2015 at 1:02 PM, Steven D'Aprano <steve@pearwood.info> wrote:
> 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?

Hi, I'm trying to figure out why my object is coming out as an
instance of list, when it shouldn't be.

1) Is it really the object you think it is?
2) Does that type of object define __instancecheck__?

There are certain normal, default expectations. We all know what those
are. I was asking if these expectations had been modified in any way.

ChrisA

Back to comp.lang.python | Previous | NextPrevious 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