[Bf-python] foo_CheckPyObject() procedure vs BPy_foo_Check() macro

Ken Hughes khughes at pacific.edu
Wed Mar 14 18:54:38 CET 2007


Another thing for future clean-ups:

Most objects have two ways define to check their type: the 
foo_CheckPyObject() procedure and the BPy_foo_Check() macro.  Both do 
the same thing:

int foo_CheckPyObject( PyObject * pyobj )
{
         return ( pyobj->ob_type == &foo_Type );
}

#define BPy_foo_Check(v) ((v)->ob_type==&foo_Type)

Is there a reason to have both?  If not, which should we keep?  I prefer 
the macro since it's quicker and I assume not much larger (if at all) 
than the call overhead.

Ken



More information about the Bf-python mailing list