Again I don't see what you are attempting. Python has no concept of "passing
arguments to a property", there's no reason why this should work, and I don't
know what it would mean if it did?
Why is it that you cannot simply implement __getitem__?
If you want "x.y[z]", do
cdef class YAttr:
def __getitem__(self, z): ...
cdef class XObject:
cdef public YAttr data
Dag Sverre Seljebotn
-----Original Message-----
From: Mattia Ziulu <[email protected]>
Date: Friday, Aug 28, 2009 5:30 pm
Subject: Re: [Cython] Expose a *float element to Python namespace
To: [email protected]: [email protected]
Incidentally, this doesn't work:
>
> def getdata(self, x, y):
> return self.ptr.data[x * self.ptr.columns + y]
> def setdata(self, x, y, n):
> self.ptr.data[x * self.ptr.columns + y] = n
> data = property( getdata, setdata )
>
>No matter how I access foo.data it just doesn't pass the parameters. I guess
>it's intended behavior.
>Anyway, thanks Dag, I'll see if I can hack together something, but probably
>I'll leave it as it is, which is gonna be fine enough for now! Tusen takk!
>
> - Greenspun's Tenth Rule of Programming: any sufficiently complicated C or
> Fortran program contains an ad hoc informally-specified bug-ridden slow
> implementation of half of Common Lisp. -
>
>
>
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev