By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,675 Members | 2,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,675 IT Pros & Developers. It's quick & easy.

Python C Object Comparison

P: n/a
Dear All,

I have some question regarding embedding and exposing of C pointers.

We have embedded python and extended to expose our APIs and c objects to
Every thing is working fine as far as customizing our application
through python.

How ever i am expecting following behavior but it failed. Can some oe
suggest a work around!!

Here is my python code

import myModule


# basically both above functions return same C pointer.
# so i want to compare
if(a==b): print "They are same"
else : print "They are different"

python always prints they are different,
I guess this is because in python layer we create PythonCObject for
every C pointer, and that is how it is exposed to python. Though both
the APIs are returning the same C pointer, they are different instances
of PythonCObject.
So i guess that is the reason comparison is failing.
How ever is it possible to make python to compare actual C pointer,
rather than the PythonCObject Pointer.

Can some one please suggest

Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.