Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95677
| From | Rob Gaddi <rgaddi@technologyhighland.invalid> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | isinstance() and multiple inheritance/ctypes |
| Date | 2015-08-26 21:21 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <mrlalj$nlt$1@dont-email.me> (permalink) |
I'm running into some strangeness trying to work with the bitfield module from my ctypes-bitfield package (on PyPi). I'm trying to use isinstance (), and it's kinda sorta lying to me. ----- IPython session (Python 3.4 under Linux) ------- In [649]: bf.__mro__ Out[649]: (bitfield._TD, _ctypes.Union, _ctypes._CData, bitfield.Bitfield, builtins.object) In [650]: isinstance(bf, bitfield.Bitfield) Out[650]: False In [651]: bf.__bases__ Out[651]: (_ctypes.Union, bitfield.Bitfield) In [652]: bf.__bases__[1] Out[652]: bitfield.Bitfield In [653]: bf.__bases__[1] is bitfield.Bitfield Out[653]: True ------------------------------------------------------- Is there an issue with isinstance and multiple inheritance? Conversely is there an issue with isinstance and ctypes derived classes (Bitfield isn't, but Bitfield is a mixin that always works with Unions) I know that ctypes classes can get really wonky on this stuff. More generally, is there any good way to introspect ctypes derived classes? I have to figure out whether things are derived from Structure, Union, Array etc. through some ugly indirect methods, and have no idea why. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll 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