[Cython] fundamentals question
Stefan Behnel
stefan_ml at behnel.de
Sun May 31 08:38:46 CEST 2009
Chris Colbert wrote:
> On Tue, May 19, 2009 at 5:17 PM, Robert Bradshaw wrote:
>>>> def testload(filename):
>>>> cdef IplImage* img = load(filename)
>>>> cdef PyIplImage pyimg = PyIplImage
>>>> pyimg.img = img
>>>> return pyimg
>
> it seems a little "off" to programatically set every attribute one
> by one every time i create an instance of that type.
Just write a factory function to do it for you. That's actually a common
(and recommended) pattern.
> Is it not recommended to declare a property for every attribute I want
> access from in python?
If all you need is plain value access, that's what they are made for.
Stefan
More information about the Cython-dev
mailing list