On Apr 22, 2009, at 5:20 PM, Greg Ewing wrote:

> Robert Bradshaw wrote:
>
>> You have to ignore the type-specific optimizations, because mylist
>> (or a subclass thereof) might override the default behavior.
>
> That's somewhat tricky in Pyrex, because it makes its
> optimisation decisions based on the static type of the
> object. So if you pass your list subclass to something
> declared as taking a list, the list optimisastions will
> get done on it anyway.
>
> I'm not sure what's the best thing to do here -- only
> do the optimisations for something declared as exactly
> a list, or for any subclass of list.

In Cython we only allow None or exactly a list to be assigned to a  
cdef list variable, not subclass thereof. We discussed this when we  
introduced it, and I am still convinced it is the right thing to do,  
but perhaps this makes subclassing messier.

- Robert

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

Reply via email to