[issue33002] Making a class formattable as hex/oct integer requires both __int__ and __index__ for no good reason

2018-03-05 Thread Josh Rosenberg
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

[issue33002] Making a class formattable as hex/oct integer requires both __int__ and __index__ for no good reason

2018-03-05 Thread Josh Rosenberg
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