Lisandro Dalcin wrote: > On Fri, Mar 13, 2009 at 12:42 PM, Carl Witty <carl.wi...@gmail.com> wrote: >> On Fri, Mar 13, 2009 at 12:53 AM, Stefan Behnel <stefan...@behnel.de> >> wrote: >>>> I don't understand why I'm getting the error. If I call a cdef >>>> function >>>> instead of a cdef method, it works OK; but shouldn't I be able to call >>>> a >>>> cdef method and passing a C type instead of a Python type? Otherwise, >>>> I >>>> will need to add an external cdef function for each class to create >>>> the >>>> object from the struct... I must be doing something wrong :). >>> >>> I consider this a deficiency of Cython. It should know the type of the >>> result when you call an extension type. >>> >>> http://trac.cython.org/cython_trac/ticket/232 >> >> Hmm... I hope that eventually Cython will allow overriding __new__, at >> which point calling an extension type won't necessarily return a value >> of that type. (I see that Robert already made this point in a comment >> on the ticket.) > > But if a typecheck is done, we could dispatch a (polymorfic) C call of > a Python call... Am I missing something?
A typecheck would only catch the case that you return the exact type, not a subtype (which works perfectly fine otherwise). And a full fledged isinstance() sounds a bit too heavy for this. Stefan _______________________________________________ Cython-dev mailing list Cython-dev@codespeak.net http://codespeak.net/mailman/listinfo/cython-dev