[issue1766304] improve xrange.__contains__
Alexander Belopolsky
report at bugs.python.org
Fri Feb 29 22:33:17 CET 2008
Alexander Belopolsky added the comment:
Here are my comments on the py3k patch:
1. Sign of a PyLong object o is the same as the sign of Py_SIZE(o). I
would think it is safe to use this fact within python core. (User code
that may need to work across multiple versions of python may need to be
more conservative.)
2. If you choose to use zero in the code, there is no need to create it
twice per call.
3. Py_INCREF(zero); is unnecessary and creates a reference leak.
4. range_contains should return -1 when error is detected, not 0.
2.
_____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1766304>
_____________________________________
More information about the Python-bugs-list
mailing list