Josh Rosenberg added the comment:
Note: Obviously, defining __index__ without defining __int__ is a little
strange (it's *equivalent* to int, but can't be *coerced* to int?), so yet
another fix would be addressing #20092 so it wouldn't be possible for a type to
New submission from Josh Rosenberg :
In Python 2, making a user-defined class support formatting using the
integer-specific type codes required that __int__ be defined and nothing else
(that is, '%x' % Foo() only required Foo to provide a __int__ method). In