True, but it seems a little "off" to programatically set every attribute one by one every time i create an instance of that type.
Is it not recommended to declare a property for every attribute I want access from in python? Chris On Tue, May 19, 2009 at 5:17 PM, Robert Bradshaw < [email protected]> wrote: > On May 19, 2009, at 2:02 PM, Chris Colbert wrote: > > > What you can do is allow it to pass in a char* (bytes) object with a > > length, have a cdef set method, use opaque object pointer wrappers > > (there was a previous thread about this). > > > > i'm not sure I understand what your saying with this ^^^ > > > > You could also make a function > > > > > def testload(filename): > > > cdef IplImage* img = load(filename) > > > cdef PyIplImage pyimg = PyIplImage > > > pyimg.img = img > > > return pyimg > > > > this makes sense. Just instantiate an empty PyIplImage then set the > > pointer after instantiation. But that would mean all attributes > > (width, height, etc) would have to be accessed as properties right? > > since I wouldn't be able to set them on __init___ > > You can set readonly attributes from C. > > - Robert > > > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev >
_______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
