Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python C Object Comparison

Thread Tools

Python C Object Comparison

Anand K Rayudu
Posts: 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


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparison of 2 files and generating the output based on comparison Deepu Perl Misc 1 02-07-2011 03:09 PM
Re: default object comparison considered harmful? Kay Schluehr Python 7 05-17-2008 12:15 AM
Bitwise Object Comparison - Is it possible & safe? D. Susman C++ 19 03-19-2008 02:05 PM
Price Comparison Service. Best Deal. Special Coupon rapee Digital Photography 0 03-14-2008 06:46 AM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM