Serhiy Storchaka added the comment:

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().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30302>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to