Style guide news!

Do you write C code for CPython itself?

PEP 7 (Style Guide for C Code) has been updated to allow putting newlines before operators, "Knuth style":

if (type->tp_dictoffset != 0
&& base->tp_dictoffset == 0
&& type->tp_dictoffset == b_size
&& (size_t)t_size == b_size + sizeof(PyObject *))
{
return 0;
}

This is similar to PEP 8 and Black style for Python code.

https://github.com/python/peps/pull/3931/files

https://peps.python.org/pep-0007/#code-lay-out

#Python #PEP7 #PEP8 #StyleGuide #KnuthStyle

PEP 7: Break lines before operators ("Knuth's style") by encukou · Pull Request #3931 · python/peps

As discussed in: https://discuss.python.org/t/pep-7-break-lines-before-operators-like-pep-8/62402 It doesn't make much sense for C and Python to be different here, and the reasons for "Knu...

GitHub