Robert Bradshaw wrote: > On Mar 13, 2009, at 10:24 AM, Carl Witty wrote: >> How about this? In the hypothetical future version of Cython that >> allows overriding __new__, say that the overrides have to be declared >> in the .pxd file, with >> >> cdef TYPE __new__(self, foo, bar) >> >> (where TYPE defaults to the class being declared, if omitted). So >> when generating code, if the class doesn't override __new__, you know >> that calling the class returns an instance; if the class does override >> __new__, then the return type is explicitly given. This could be a >> parent class, for my use case where I want to return an instance of a >> sibling class; or it could be "object", if anybody ever has a use case >> for having __new__ return an arbitrary object. > > +1. This will make it possible to optimize the common case while > providing (future) flexibility.
+1 sounds like a good way to do it. Carl, can you write a comment for the ticket so that it has your name in it? I'll change it into a feature request. http://trac.cython.org/cython_trac/ticket/232 Stefan _______________________________________________ Cython-dev mailing list Cython-dev@codespeak.net http://codespeak.net/mailman/listinfo/cython-dev