swig or something else....

Achim Domma achim.domma at syynx.de
Sat Jul 6 13:24:06 EDT 2002


Hi,

perhaps a look at boost.python (www.boost.org) could help ?

Achim

"tALSit" <talsit at talsit.org> wrote in message
news:3d26f83a at dnews.tpgi.com.au...
> Hi, I'm trying to interface a system i made in C++ with python using swig.
> Ok, i've got it working, but I find it pretty ugly. Actually, way ugly.
>
> Given a C++ class:
>
> class cNode {
> public:
>     cNode (const std::string & name);
>     set (const std::string & attr, const std::string & value);
> // etc
> };
>
> Swig generates a series of _functions_, not a class with methods, so in
> python I have to do this:
>
> obj = my_module.new_cNode ("someName")
> my_module.cNode_set ("attrib", "value")
>
> Instead of something more like this:
>
> obj = my_module.cNode ("someName")
> obj.set ("attrib", "value")
>
> Is this a limitation of swig, python or am I doing it wrong?
> Because if it's a swig limitation, I might be able to do a workaround for
> the 3-4 classes i need interfacing. If it's python, well, it doesn't
matter.
> But if it's me, please advise!
>
> Thanks!!
>
>
>





More information about the Python-list mailing list