[PyQt] How to test for isinstance(obj, sip.wrappertype)?
Phil Thompson
phil at riverbankcomputing.com
Sun Apr 19 22:02:52 BST 2020
On 19/04/2020 20:52, Steve Borho wrote:
> Hello,
>
> How does one test that a Python object is a SIP wrapped object?
>
> Python 3.7.7 (default, Mar 10 2020, 15:43:33)
> [Clang 11.0.0 (clang-1100.0.33.17)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from foo import barstruct
>>>> type(barstruct)
> <class 'sip.wrappertype'>
>>>> import sip
>>>> t = barstruct()
>>>> isinstance(t, sip.wrappertype)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: module 'sip' has no attribute ‘wrappertype'
Works fine for me.
Phil
More information about the PyQt
mailing list