New submission from Mark Dickinson: 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 ---------- components: Extension Modules messages: 194966 nosy: mark.dickinson, zach.ware priority: normal severity: normal status: open title: Pure Python operator.index doesn't match the C version. type: behavior versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18712> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com