[C++-sig] exposing C structures in pyste (modifying copyable attribute?)

Alexis H. Rivera-Rios ahrivera at yahoo.com
Mon Dec 6 19:03:02 CET 2004


Hi,

I have some C data structures that I want to expose in
python. For example,

struct Point
{
int a;
int b;
};

I do the following in pyste to expose the structure:
Class("Point","my_header.h")

But by default, pyste generates this code:
 class_< Point, boost::noncopyable>("Point", no_init)
        .def_readwrite("a", &Point::x)
        .def_readwrite("b", &Point::y)

My questions are: 
-Is there a way to tell pyste that I want this
structure to be copyable? (Without having to modify
the generated c++ code)
- Out of curiosity, is there a way to modify the
read/write attributes from Pyste
- Is this an acceptable thing to do? Or should I
create a c++ wrapper class to my structures and expose
that?

Thanks
Alexis


=====
Programming Tutorial:
In Python: To do this, do this
In Perl: To do this, do this or this or this or this...
In C: To do this, do this, but be careful
In C++: To do this, do this, but don't do this, be careful of this, watch out for this, and whatever you do, don't do this


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250



More information about the Cplusplus-sig mailing list