[issue27078] Make f'' strings faster than .format: BUILD_STRING opcode?

Antti Haapala report at bugs.python.org
Sun Sep 4 02:58:22 EDT 2016


Antti Haapala added the comment:

Though it is clean to do like this: let _PyUnicode_JoinArray have `NULL` mean empty string, as it is more logical anyway; then PyUnicode_Join itself just needs to:

   if (separator == NULL) {
       separator = PyUnicode_FromOrdinal(' ');
       /* check omitted */
       res = _PyUnicode_JoinArray(separator, items, seqlen);
       Py_DECREF(separator);
   }
   else {
      res = _PyUnicode_JoinArray(separator, items, seqlen);
   }

The NULL argument I guess isn't that common to pass to PyUnicode_Join (Python code especially would always have to pass in ' ' instead), so this shouldn't really affect performance for any case at all.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27078>
_______________________________________


More information about the Python-bugs-list mailing list