
Should the implementation of __trunc__ have its own slot like we have for nb_index? Raymond ------------------------------------------------------- rhettinger@localhost ~/py26/Objects $ grep "__trunc__" *.c floatobject.c: {"__trunc__", (PyCFunction)float_trunc, METH_NOARGS, intobject.c: {"__trunc__", (PyCFunction)int_int, METH_NOARGS, longobject.c: {"__trunc__", (PyCFunction)long_long, METH_NOARGS,

I don't see why. __index__ has a slot because its primary use is to be called from C code, where slots add a slight performance advantage. __trunc__ doesn't get called from C AFAIK. On Jan 29, 2008 11:04 AM, Raymond Hettinger <python@rcn.com> wrote:
-- --Guido van Rossum (home page: http://www.python.org/~guido/)

I don't see why. __index__ has a slot because its primary use is to be called from C code, where slots add a slight performance advantage. __trunc__ doesn't get called from C AFAIK. On Jan 29, 2008 11:04 AM, Raymond Hettinger <python@rcn.com> wrote:
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (2)
-
Guido van Rossum
-
Raymond Hettinger