On Monday, April 20, 2015 at 12:55:27 PM UTC-7, Jeroen Demeyer wrote: > > > Thank you! Is there a penalty for doing "type(self)" twice? > I don't think so, but you should profile. When in doubt, use > > cdef type t = type(self) # The "cdef type" is very important! > obj = t.__new__(t) >
Yes, very much so. Otherwise the lookup of the __new__ method is via generic code. I think it might even be a bug that if you have cdef object o = type(self) obj = (<type>o).__new__(t) one gets different code than from t.__new__(t) . It looks like type propagation through expressions in cython can use some improvement. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.