[Python-3000] A better way to initialize PyTypeObject

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Nov 30 01:38:53 CET 2006


Brett Cannon wrote:

> Or the other option is that in the future we just don't have the 
> distinction and make sure that the __getitem__ methods do the requisite 
> type checks.  The type check is done at some point in the C code anyway 
> so it isn't like there is a performance reason for the different slots.

The performance reason is that C code can call the
sq_getitem slot with a C integer directly, without
having to convert to a Python integer and back
again.

Has anyone ever tested whether this is an important
enough gain to be worth keeping the dual slots?

--
Greg


More information about the Python-3000 mailing list