Re: [Python-Dev] [Python-ideas] pep 7 line break suggestion differs from pep 8

On Tue, Apr 19, 2016 at 5:33 AM, Joseph Jevnik <joejev@gmail.com> wrote:
I saw that there was recently a change to pep 8 to suggest adding a line break before a binary operator. Pep 7 suggests the opposite:
When you break a long expression at a binary operator, the operator goes at the end of the previous line, e.g.:
if (type->tp_dictoffset != 0 && base->tp_dictoffset == 0 && type->tp_dictoffset == b_size && (size_t)t_size == b_size + sizeof(PyObject *)) return 0; /* "Forgive" adding a __dict__ only */
I imagine that some of the reasons for making the change in pep 8 for readability reasons will also translate to C; maybe pep 7 should also be updated.
I would agree with this. Passing it directly to python-dev as that's where the key decision makers are. ChrisA

[ideas to bcc] I'm not as excited about this as I am about the PEP 8 change. PEP 8 affects most Python programmers. But PEP 7 is really just for CPython and its extensions, and I don't think it has found anything like as widespread a following as PEP 8. I worry that if we change this in PEP 7 we'll just see either massing inconsistent code or endless diffs that do nothing but change the formatting (and occasionally introduce a bug). And I don't think it would do as much good -- reading and understanding C code is primarily a matter of knowing the language, and the audience is much more heavily skewed towards experts. IOW, -1. On Mon, Apr 18, 2016 at 1:27 PM, Chris Angelico <rosuav@gmail.com> wrote:
On Tue, Apr 19, 2016 at 5:33 AM, Joseph Jevnik <joejev@gmail.com> wrote:
I saw that there was recently a change to pep 8 to suggest adding a line break before a binary operator. Pep 7 suggests the opposite:
When you break a long expression at a binary operator, the operator goes at the end of the previous line, e.g.:
if (type->tp_dictoffset != 0 && base->tp_dictoffset == 0 && type->tp_dictoffset == b_size && (size_t)t_size == b_size + sizeof(PyObject *)) return 0; /* "Forgive" adding a __dict__ only */
I imagine that some of the reasons for making the change in pep 8 for readability reasons will also translate to C; maybe pep 7 should also be updated.
I would agree with this. Passing it directly to python-dev as that's where the key decision makers are.
ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido)
participants (2)
-
Chris Angelico
-
Guido van Rossum