Yes, the properties likely are redundant.

Dag Sverre Seljebotn
-----Original Message-----
From: Mattia Ziulu <[email protected]>
Date: Friday, Aug 28, 2009 6:03 pm
Subject: Re: [Cython] Expose a *float element to Python namespace
To: [email protected]: [email protected]

Mmh, if I call foo[0,0], passing the indexes like a tuple that is, if I got it 
right, it works correctly. 
>At this point though a properties is redundant, isn't it, since I already 
>access the internal data via __getitem__, right? It could be useful for the 
>'matrix-like' representation, though, which I'm not getting using my 
>implementation __getitem__...gonna play with it a little bit more.
>
>On Fri, Aug 28, 2009 at 5:43 PM, Robert Bradshaw 
><[email protected]> wrote:
> 
>
> 
>First, implement __getitem__ and __setitem__, so you can do foo[1,5]
>= 17. Second, how about
>
>     property data:
>         def __get__(self):
>             cdef int i,j
>             return [ [ data[i+self.columns*j ] for i in range
>(self.columns) ] for j in range(self.rows) ]
>
> Which should be faster at least (though you're still doing a lot of
> float -> Python object conversions.
>
>_______________________________________________
> 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

Reply via email to