Robert Bradshaw wrote:
> On Apr 21, 2009, at 10:43 PM, Stefan Behnel wrote:
>>     cdef class mylist(list):
>>         pass
>>
>> Will Pyrex handle the above type in any special way because it
>> knows that mylist is of type 'list', or will it ignore the
>> builtin type specific optimisations for it?
>
> You have to ignore the type-specific optimizations, because mylist
> (or a subclass thereof) might override the default behavior.

As would Cython, currently (so that's the answer I'd expect). That's a
different topic now, but if the subtype does not override __getitem__(),
most list optimisations would work just fine, for example. Same for the
append() optimisation if the type does not override append() or
__getattr(ibute)__().

Now that we have a transform for builtin type method optimisations anyway,
we could check the type definition itself, instead of restricting it to
the plain builtin types.

One reason more to fix Cython here so that we can make builtin type
redefinition a real error.

Stefan

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

Reply via email to