Thanks for the response. The code snippet I sent deals with new style classes only so I assume that in some cases isinstance falls back to old-style-like handling which then asks for __bases__ and __class__ etc, possibly incorrectly so on new style classes. Thanks again! Martin -----Original Message----- From: Greg Ewing [mailto:greg.ewing at canterbury.ac.nz] Sent: Monday, June 26, 2006 8:00 PM To: Martin Maly Cc: python-dev at python.org Subject: Re: [Python-Dev] Semantic of isinstance Martin Maly wrote: >>>>isinstance(D(), D) > > True > >>>>isinstance(D(), C) > > D.getclass > True This looks like a new/old class thing. Presumably once everything is changed over to new-style classes, this inconsistency will go away. And from the current behaviour, it looks like __class__ and __bases__ will be bypassed by isinstance() (unless Guido decides to change that). -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiem! | Christchurch, New Zealand | (I'm not a morning person.) | greg.ewing at canterbury.ac.nz +--------------------------------------+
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4