Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

encukou
Copy link
Member

@encukou encukou commented Sep 2, 2024

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 "Knuth's style" in PEP 8 apply to C code as well.


📚 Documentation preview 📚: https://pep-previews--3931.org.readthedocs.build/

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m honestly not sure it’s worth prescribing anything. Maybe we can just remove the rule (shortening the PEP) or say that you can do it either way (but be consistent with surrounding code) — that’s all redundant but some people cannot live without rules. :-)

@encukou
Copy link
Member Author

encukou commented Sep 4, 2024

I'm not happy about PEP 8 & 7 turning into rules (even machine-checkable ones, somehow). But a summary of what we find readable is helpful.

Is this what you meant, or do you want to remove the brace formatting as well?

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The braces placement aids readability tremendously, (don’t want to miss a brace hidden in the middle), the operator thing feels more like a matter of taste.

Copy link
Contributor

@willingc willingc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @encukou. Thanks! Much cleaner to read.

@encukou
Copy link
Member Author

encukou commented Sep 9, 2024

Thank you for the reviews!

@encukou encukou merged commit 2dd6c9d into python:main Sep 9, 2024
6 checks passed
@encukou encukou deleted the pep7-knuth branch September 9, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants