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

Campbell Barton cbarton at metavr.com
Thu Mar 15 01:33:44 CET 2007


Hi Ken, goon find on the dealloc,

agree if they arnt needed, go ahead and remove..
also agree that we should use the macro only

Ken Hughes wrote:
> 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
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
> 


-- 
See MetaVR Visuals Used at the Combat Studies Institute
http://www.metavr.com/casestudies/baghdadviews.html

Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241



More information about the Bf-python mailing list