A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2017-June/148241.html below:

[Python-Dev] PEP 7 and braces { .... } on if

[Python-Dev] PEP 7 and braces { .... } on if [Python-Dev] PEP 7 and braces { .... } on ifEthan Furman ethan at stoneleaf.us
Mon Jun 5 11:19:49 EDT 2017
>          if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
>                               "invalid escape sequence '\\%c'",
>                               *first_invalid_escape) < 0) {
>              Py_DECREF(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:

- having all the arguments on separate lines means
   - the function and first argument don't get run together
   - it's easy to pick out the individual arguments
- having the opening brace on its own line means
   - a little extra white space to buffer the condition and the body
   - it's easier to read the function name and then drop down to the
     body

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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4