That's interesting, but there is some nuance here.
The problem with using whitespace in the PEP8 example is that it is in the middle of a statement, which disrupts readability. Alignment of comments following statements is different because the things that are separate are individual units.
For instance, there are clear problems with readability here:
The quick brown fox jumped over the lazy dogs.
She sells seashells by the seashore.
...but not with this:
Goodnight, bears. Goodnight, clocks.
Goodnight, chairs. And goodnight, socks.
In fact, in the latter example, readability is improved by separating the different units. So, too, is readability improved by using whitespace to set comments apart from programming statements.
The problem with using whitespace in the PEP8 example is that it is in the middle of a statement, which disrupts readability.
No, that's not the problem. I already said what the problem was. The problem is that it can cause unnecessary merge conflicts. This is true regardless of whether you're commenting or assigning. Most style choices don't have an impact beyond the immediate readability. This style choice causes further problems with version control.
And among those that are, not all projects have multiple branches that raise the prospect of merge conflicts.
Why should a technical consideration that exists in a sub-subset of projects justify a general-purpose style rule for all projects? Your explanation of “the problem” does not apply to a vast proportion of Python projects.
If you were arguing: "In multi-branch, version-controlled projects, space alignment should not be used because this problem can occur," then I'd completely agree with you.
But you appear to be arguing a universal concept based on a select group: "Space alignment should not be used because in multi-branch, version-controlled projects, this problem can occur." That's a wildly overbroad argument because the problem is irrelevant to a lot of other projects.
And if you think that version-controlled, multi-branch projects are "the norm" in Python programming, then I'm going to go ahead and kind of disagree with you.
3
u/[deleted] Apr 30 '20
That's interesting, but there is some nuance here.
The problem with using whitespace in the PEP8 example is that it is in the middle of a statement, which disrupts readability. Alignment of comments following statements is different because the things that are separate are individual units.
For instance, there are clear problems with readability here:
...but not with this:
In fact, in the latter example, readability is improved by separating the different units. So, too, is readability improved by using whitespace to set comments apart from programming statements.