[Python-Dev] Let's update CObject API so it is safe and regular!

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 2 13:28:34 CEST 2009

Jim Fulton wrote:

> The only type-safety mechanism for a CObject is it's identity.  If you  
> want to make sure you're using the foomodule api, make sure the  address 
> of the CObject is the same as the address of the api object  exported by 
> the module.

I don't follow that. If you already have the address of the
thing you want to use, you don't need a CObject.

> 2. Only code provided by the module provider should be accessing the  
> CObject exported by the module.

Not following that either. Without attaching some kind of
metadata to a CObject, I don't see how you can know whether
a CObject passed to you from Python code is one that you
created yourself, or by some other unrelated piece of

Attaching some kind of type info to a CObject and having
an easy way of checking it makes sense to me. If the
existing CObject API can't be changed, maybe a new
enhanced one could be added.


More information about the Python-Dev mailing list