[Python-Dev] Slot for trunc (original) (raw)

Eric Smith eric+python-dev at trueblade.com
Tue Jan 29 20:37:43 CET 2008


Raymond Hettinger wrote:

[GvR]

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. I thought the trunc method only gets called from the C code for the trunc() function which is currently implemented with PyObjectCallMethod(number, "trunc", "") instead of a fast call to a slot.

And if trunc qualifies, what about format, which is similar? I'm not pushing for it, I just wonder how the decision is made.

Eric.



More information about the Python-Dev mailing list