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.

作者 mark.dickinson
收信人 mark.dickinson, zach.ware
日期 2013-08-12.14:09:37
SpamBayes Score -1.0
Marked as misclassified
Message-id <1376316578.03.0.462256957334.issue18712@psf.upfronthosting.co.za>
In-reply-to
内容
Nitpick: the pure Python version of operator.index (new in Python 3.4, introduced in issue #16694) doesn't match the C version, in that it looks up __index__ on the object rather than the class.


iwasawa:cpython mdickinson$ ./python.exe
Python 3.4.0a1+ (default:9e61563edb67+, Aug 12 2013, 14:45:12) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from test import support
>>> py_operator = support.import_fresh_module('operator', blocked=['_operator'])
>>> c_operator = support.import_fresh_module('operator', fresh=['_operator'])
>>> class A(int): pass
... 
>>> a = A(42); a.__index__ = lambda: 1729
>>> 
>>> py_operator.index(a)
1729
>>> c_operator.index(a)
42
历史
日期 用户 动作 参数
2013-08-12 14:09:38mark.dickinson修改recipients: + mark.dickinson, zach.ware
2013-08-12 14:09:38mark.dickinson修改messageid: <1376316578.03.0.462256957334.issue18712@psf.upfronthosting.co.za>
2013-08-12 14:09:37mark.dickinson链接issue18712 messages
2013-08-12 14:09:37mark.dickinson创建