Message297441
| Author |
serhiy.storchaka |
| Recipients |
belopolsky, martin.panter, musically_ut, r.david.murray, serhiy.storchaka, vstinner |
| Date |
2017年06月30日.18:46:23 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1498848383.78.0.551914100202.issue30302@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Don't wait me. I have no preferences and just remind about the Martin's suggestion.
The C code looks cumbersome. It could be made a little simpler if accumulate arguments into a string rather than a list.
if (GET_TD_SECONDS(self) != 0) {
Py_SETREF(args, PyUnicode_FromFormat("%U%sseconds=%d",
args, sep, GET_TD_SECONDS(self)));
if (args == NULL)
return NULL;
sep = ", ";
}
args is initialized by an empty Python string, sep is initialized by "". PyUnicode_Join() at the end is not needed. This would save more than 20 lines.
The code could be simplified even more if use the char buffer(s) and PyOS_snprintf instead of PyUnicode_FromFormat(). |
|