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

M

Michal Vitecek

hello,

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?

HELP!
 
M

Michael Hudson

Michal Vitecek said:
hello,

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.

The problem is that this question isn't terribly wll defined. Why do
you want to know?

Cheers,
mwh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top