hi,
How can I setup swig so that python will recognize a pointer to a class as the object itself. More specifically, I have a function MyClass *return_this() const;
and I would like python to treat MyClass as the actual object and not as a pointer.
thanks, Keren.
Keren Lasker wrote: > How can I setup swig so that python will recognize a pointer to a class > as the object itself.
In Python everything is a pointer - there's no such thing as "the object itself". So, what do you actually want to do?
BTW, if SWIG is giving you PySwigObjects rather than actual proxy class objects (i.e. opaque pointers rather than typed pointers), it's probably because it hasn't seen a full definition of the MyClass class before it encountered the MyClass * function.
Ben
thanks - I just tried to do show on the class and got this PySwigObjects printout instead. I will change the order of files in the swig.in file - THANKS !!! On Oct 16, 2009, at 11:50 PM, Ben Webb wrote:
> Keren Lasker wrote: >> How can I setup swig so that python will recognize a pointer to a >> class as the object itself. > > In Python everything is a pointer - there's no such thing as "the > object itself". So, what do you actually want to do? > > BTW, if SWIG is giving you PySwigObjects rather than actual proxy > class objects (i.e. opaque pointers rather than typed pointers), > it's probably because it hasn't seen a full definition of the > MyClass class before it encountered the MyClass * function. > > Ben > -- > ben@salilab.org http://salilab.org/~ben/ > "It is a capital mistake to theorize before one has data." > - Sir Arthur Conan Doyle > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
participants (2)
-
Ben Webb
-
Keren Lasker