Implementing PyMyType_Check methods with Python C API?

Posted by Paul D. on Stack Overflow See other posts from Stack Overflow or by Paul D.
Published on 2010-05-10T19:34:25Z Indexed on 2010/05/10 19:44 UTC
Read the original article Hit count: 457

Filed under:
|
|
|

All the Python-provided types have a check method (i.e., PyList_Check) that allows you to check if an arbitrary PyObject* is actually a specific type.

How can I implement this for my own types? I haven't found anything good online for this, though it seems like a pretty normal thing to want to do.

Also, maybe I'm just terrible at looking through large source trees, but I cannot for the life of me find the implementation of PyList_Check or any of it's companions in the Python (2.5) source.

© Stack Overflow or respective owner

Related posts about python

Related posts about c