[issue18712] Pure Python operator.index doesn't match the C version.

Serhiy Storchaka report at bugs.python.org
Sun Aug 18 09:38:45 CEST 2013


Serhiy Storchaka added the comment:

> For completeness, can you post one line saying why the much simpler solution "range(a).stop" is not accepted?

Because it is implementation detail. The range() function if it will be implemented in Python needs operator.index().

The main purpose of adding Python implementation of the operator module was to provide an implementation which can be used in alternative Python implementations (e.g. PyPy). The CPython itself doesn't use it. And now I doubt that such complicated implementation will be helpful.

Perhaps we need a builtin which exposes _PyType_Lookup() at Python level.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18712>
_______________________________________


More information about the Python-bugs-list mailing list