[Python-Dev] PEP 7 and braces { .... } on if (original) (raw)
Serhiy Storchaka storchaka at gmail.com
Mon Jun 5 01:41:22 EDT 2017
- Previous message (by thread): [Python-Dev] PEP 7 and braces { .... } on if
- Next message (by thread): [Python-Dev] PEP 7 and braces { .... } on if
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
03.06.17 23:30, Barry Warsaw пише:
On Jun 03, 2017, at 07:25 PM, Serhiy Storchaka wrote:
But the latter example continuation lines are intended at the same level as the following block of code. I propose to make exception for that case and allow moving an open brace to the start of the next line.
if (type->tpdictoffset != 0 && base->tpdictoffset == 0 && type->tpdictoffset == bsize && (sizet)tsize == bsize + sizeof(PyObject *)) { return 0; /* "Forgive" adding a dict only */ } Agreed! https://github.com/python/peps/issues/283 https://github.com/python/peps/pull/284
Thank you for opening a PR Barry! But there is some disputation. Barry and Victor prefer moving a brace on a new line in all multiline conditional cases. I think that it should be done only when the condition continuation lines and the following block of the code have the same indentation (as in 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;
}
What other core developers think about this?
- Previous message (by thread): [Python-Dev] PEP 7 and braces { .... } on if
- Next message (by thread): [Python-Dev] PEP 7 and braces { .... } on if
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]