Detecting PyCObjects using type()

Jeff Putsch putsch at fiber.mxim.com
Fri May 18 11:45:57 EDT 2001


Howdy,

I would like to be able to do something like this:

   class C:
      def __init__(self,arg1):
         if type(arg1) != type(PyCObject):
            raise AnException

Unfortunately type(PyCObject) is not legal.

If arg1 is a PyCObject, the type(arg1) returns:

   <type 'PyCObject'>

What I can not figure out is what "type(PyCObject)" should be, to make the
test work. With other types syntax like this works:

   if type(arg1) == type('')

So my question boils down to this: what is the equivalent of "type('')" when
using PyCObjects?

Thanks,

Jeff.





More information about the Python-list mailing list