[issue2610] string representation of range

Benjamin Peterson report at bugs.python.org
Thu Apr 10 23:05:18 CEST 2008


Benjamin Peterson <musiccomposition at gmail.com> added the comment:

Thanks for the patch! You can avoid the compiler warning by casting to
reprfunc like this:

(reprfunc)range_str /* tp_str */

Also, some of the whitespace needs reformating. Please put a space
between the parameters passed a function, and remove the ones in the
conditionals.

You should use PyObject_RichCompareBool.

All the calls to functions like PyLong_FromLong and PyNumber_* can
possibly return NULL on error, so you must check for that. Sometimes
it's useful to have a goto for failures at the end of your function in
which you Py_XDECREF everything.

Could you take the space from the "<" and ">" at the end of the
representation?

----------
nosy: +benjamin.peterson

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2610>
__________________________________


More information about the Python-bugs-list mailing list