On Sep 18, 2009, at 07:31 , Robert Bradshaw wrote:

> On Sep 17, 2009, at 2:18 PM, Magnus Lie Hetland wrote:
>
>> I've encountered some behavior that I don't quite understand in  
>> Cython
>> pure Python mode.
>
> Is this just in pure mode, or a general problem?

Only in pure mode. I used the same code (modulo porting ;) with plain  
Cython before.

> (FYI, pure mode is still somewhat experimental--users like you will  
> help iron out all the corner cases (though it should basically just  
> work)).

OK with me :)

>>> cdef class Foo:
>>>
>>>    cpdef quux(self)
>>>
>>> cdef class Bar(Foo):
>>>
>>>    cpdef quux(self)
>>>
>>> cdef class Baz(Foo):
>>>
>>>    cpdef quux(self)
>
> You shouldn't need to re-declare the cpdef method in each class--it  
> should get it by inheritance.

Sounds reasonable :) I just mapped the pyx stuff rather directly to  
the pxd (and the method was overridden in the pyx file).

> (Should we raise an error in this case?)

I have no opinion, really. My intuition was that the pxd file just  
gave you info about what was in the pyx file, and as long as that  
information is correct, an error might be counter-intuitive ... maybe?  
But either way is fine with me.

> Do you still have problems if you don't redeclare the method in Bar  
> and Baz? In any case, it's a bug one way or another.

Yes, I do, actually :-/

I have now troid all eight combinations of declaring/not declaring the  
method in each class, and I get the error if and only if the method is  
declared in Foo (the shared superclass), regardless of what I do in  
the other classes.

-- 
Magnus Lie Hetland
http://hetland.org


_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to