Message381639
| 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: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 |
|