消息 [334122]
The motivation for PEP 357 was certainly using an object as the index for a sequence, but that's not the only use case.
In fact PEP 357 states "For example, the slot can be used any time Python requires an integer internally"
So despite the name __index__, I think that this is now the de facto standard for "convert the object (which is some kind of integer) to a Python int without loss of precision". |
|
| 日期 |
用户 |
动作 |
参数 |
| 2019-01-21 10:48:35 | jdemeyer | 修改 | recipients:
+ jdemeyer, ronaldoussoren, ncoghlan, vstinner, serhiy.storchaka, remi.lapeyre, AVINASH MISHRA |
| 2019-01-21 10:48:34 | jdemeyer | 修改 | messageid: <1548067714.77.0.445921593222.issue35707@roundup.psfhosted.org> |
| 2019-01-21 10:48:34 | jdemeyer | 链接 | issue35707 messages |
| 2019-01-21 10:48:34 | jdemeyer | 创建 | |
|