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/148254.html below:

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

[Python-Dev] PEP 7 and braces { .... } on ifRob Cliffe rob.cliffe at btinternet.com
Tue Jun 6 20:42:23 EDT 2017
On 07/06/2017 01:30, Barry Warsaw wrote:
> On Jun 05, 2017, at 08:41 AM, Serhiy Storchaka wrote:
>
>> the example above), and the following code is enough readable:
>>
>>          if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
>>                               "invalid escape sequence '\\%c'",
>>                               *first_invalid_escape) < 0) {
>>              Py_DECREF(result);
>>              return NULL;
>>          }
> My rationale for placing the opening brace on a separate line, indented to
> under the `if` instead of hanging is that it's easier to miss the opening
> brace in the example you posted above.  Visually I (we?) tend to have a harder
> time recognizing characters sitting way out to the right.
>
> On Jun 05, 2017, at 08:19 AM, Ethan Furman wrote:
>
>> I would format that as:
>>
>>           if (PyErr_WarnFormat(
>>                   PyExc_DeprecationWarning,
>>                   1,
>>                   "invalid escape sequence '\\%c'",
>>                   *first_invalid_escape) < 0)
>>               {
>>               Py_DECREF(result);
>>               return NULL;
>>           }
> In this case I'd *still* indent the opening brace to under the `if`.  The
> mismatched indentation between the open and close braces is jarring to me.
>
>
FWIW I feel exactly the same.
Rob Cliffe
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