Message185338
In isspace, isalpha, isalnum and isdigit, I see code like:
/* Shortcut for single character strings */
if (PyString_GET_SIZE(self) == 1 &&
isspace(*p))
return PyBool_FromLong(1);
Is it intentional to not use:
if (PyString_GET_SIZE(self) == 1))
return PyBool_FromLong(isspace(*p) != 0);
which would be faster when the result is False (but a tad slower when it is True because of the extra comparison).
Also, is there a reason (other than historical) why the macros Py_RETURN_TRUE and Py_RETURN_FALSE are not used instead of their equivalent functions PyBool_FromLong(1) and PyBool_FromLong(0)?
See:
http://hg.python.org/cpython/file/e87364449954/Objects/stringobject.c#l3324 |
|
Date |
User |
Action |
Args |
2013-03-27 14:41:09 | gdementen | set | recipients:
+ gdementen |
2013-03-27 14:41:09 | gdementen | set | messageid: <1364395269.34.0.903596007794.issue17559@psf.upfronthosting.co.za> |
2013-03-27 14:41:09 | gdementen | link | issue17559 messages |
2013-03-27 14:41:08 | gdementen | create | |
|