On Sep 23, 2008, at 5:22 PM, Greg Ewing wrote: > Lisandro Dalcin wrote: >> the generated code for, let say >> 'insinstance(None, list)' has two superfluous casts: >> >> __pyx_1 = PyObject_TypeCheck(Py_None, ((PyTypeObject >> *)((PyObject*)&PyList_Type))); > > That's because PyList_Type is known to have type 'type' > (at least Pyrex knows this, I'm assuming Cyton does too). > If you declare typecheck() as taking a type for the > second argument, rather than object, you shouldn't get > those casts.
The problem is that isinstance is declared to take an object as the second parameter, and the optimization happens later on. I'm sure we could get around it if we wanted to put in the effort. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
