This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brett.cannon
Recipients Arfrever, alex, barry, brett.cannon, docs@python, eric.snow, ethan.furman, mark.dickinson, mjacob, ncoghlan, python-dev, rhettinger, serhiy.storchaka, vstinner
Date 2020-11-23.02:06:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606097211.07.0.209286271303.issue17576@roundup.psfhosted.org>
In-reply-to
Content
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__).
History
Date User Action Args
2020-11-23 02:06:51brett.cannonsetrecipients: + brett.cannon, barry, rhettinger, mark.dickinson, ncoghlan, vstinner, Arfrever, alex, docs@python, ethan.furman, python-dev, eric.snow, serhiy.storchaka, mjacob
2020-11-23 02:06:51brett.cannonsetmessageid: <1606097211.07.0.209286271303.issue17576@roundup.psfhosted.org>
2020-11-23 02:06:51brett.cannonlinkissue17576 messages
2020-11-23 02:06:50brett.cannoncreate