On Thu, 27 Aug 2015 09:12:55 +1000, Chris Angelico wrote:
> 
> You're omitting some context here, but after poking around with your
> module a bit, I'm guessing you created bf somewhat thus?
> 
>>>> bf = bitfield.make_bf("bf", (("asdf",bitfield.c_uint,2),))
>>>> bf
> <class 'bitfield.bf'>
>>>> bf.__mro__
> (<class 'bitfield.bf'>, <class '_ctypes.Union'>, <class
> '_ctypes._CData'>, <class 'bitfield.Bitfield'>, <class 'object'>)
>>>> type(bf)
> <class '_ctypes.UnionType'>
>>>> type(bf).__mro__
> (<class '_ctypes.UnionType'>, <class 'type'>, <class 'object'>)
> 
> If that's the case, then it's quite correct: bf is not a Bitfield, it is
> a subclass of bitfield.
> 
>>>> isinstance(bf,type)
> True
>>>> isinstance(bf(),bitfield.Bitfield)
> True
>>>> issubclass(bf,bitfield.Bitfield)
> True
> 

Yep, you're quite right.  bf is a subclass, not an instance, hence 
issubclass is True and isinstance is False.  One of those days with too 
many lines of code and not enough cups of coffee to compensate.

Thanks for the help, my stupid mistake.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to