Message 381639 - Python tracker
I think operator.index() should be brought to be inline with PyNumber_Index(): - If the argument is a subclass of int then return it. - Otherwise call type(obj).__index__(obj) - If not an int, raise TypeError - If not a direct int, raise a DeprecationWarning The language reference for __index__() suggests this is the direction to go (https://docs.python.org/3/reference/datamodel.html#object.__index__).