Brett Cannon <br...@python.org> added the comment:

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__).

----------
nosy: +brett.cannon

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue17576>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to