Message381639
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__). |
|
Date |
User |
Action |
Args |
2020-11-23 02:06:51 | brett.cannon | set | recipients:
+ 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:51 | brett.cannon | set | messageid: <1606097211.07.0.209286271303.issue17576@roundup.psfhosted.org> |
2020-11-23 02:06:51 | brett.cannon | link | issue17576 messages |
2020-11-23 02:06:50 | brett.cannon | create | |
|