[Python-Dev] More C API abstraction for user defined types (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Thu Jul 15 01:09:31 CEST 2010


On Wed, Jul 14, 2010 at 11:50 PM, Petre Galan <Petre.Galan at gmail.com> wrote:

No. The right interface is PyNumberLong. The purpose of the PyNumberIndex (and nbindex slot) is as index in slicing.

Allowing other objects to say "I'm a real integer, treat me as one" is exactly what the nb_index slot is for (see PEP 357). The use as an index in slicing was just the primary initial use case and the one that was chosen as the name for the new slot because nb_int was already taken for the lossy transformation. Indexing is not (and never has been) intended to be the only use case.



More information about the Python-Dev mailing list