消息 [195490]
Sorry, realized that my pure Python algorithm isn't equivalent to _PyType_Lookup() --- it fails the staticmethod example of Serhiy. A closer one would be:
for t in type(a).__mro__:
if '__index__' in t.__dict__:
return t.__dict__['__index__'].__get__(a)()
But it's still not a perfect match. I think right now the only "perfect" answer is given by workarounds like "range(a).stop"... |
|
| 日期 |
用户 |
动作 |
参数 |
| 2013-08-17 16:12:23 | arigo | 修改 | recipients:
+ arigo, mark.dickinson, zach.ware, serhiy.storchaka |
| 2013-08-17 16:12:23 | arigo | 修改 | messageid: <1376755943.08.0.713689462343.issue18712@psf.upfronthosting.co.za> |
| 2013-08-17 16:12:23 | arigo | 链接 | issue18712 messages |
| 2013-08-17 16:12:22 | arigo | 创建 | |
|