how to tell if x is an instance of new class?

Michal Vitecek fuf at
Thu Aug 19 17:05:56 CEST 2004


 i'm (once again) fighting with python C API. i'm simply unable to
 determine whether 'x' is an instance of new class or not.

 result of PyObject_Type(x) is unusable, PyType_Check(x) returns 0,
 PyType_IsSubtype(x->ob_type, &PyType_Type) returns 0,
 PyType_IsSubtype((PyTypeObject *)x, &PyType_Type) returns 0...
 how come there's no *easy-and-immediately-obvious* way to get such an
 important information? what am i missing?

		fuf		(fuf at

More information about the Python-list mailing list