[Python-Dev] PEP 7 and braces { .... } on if (original) (raw)

Ethan Furman ethan at stoneleaf.us
Mon Jun 5 11:19:49 EDT 2017


if (PyErrWarnFormat(PyExcDeprecationWarning, 1, "invalid escape sequence '\%c'", *firstinvalidescape) < 0) { PyDECREF(result); return NULL; }

What other core developers think about this?

I would format that as:

      if (PyErr_WarnFormat(
              PyExc_DeprecationWarning,
              1,
              "invalid escape sequence '\\%c'",
              *first_invalid_escape) < 0)
          {
          Py_DECREF(result);
          return NULL;
      }

Because:

All in all, it becomes easier for (at least my) suboptimal eyes to read the code.

-- Ethan



More information about the Python-Dev mailing list