r/Python • • Apr 29 '20

Discussion Tab vs Spaces

Post image
702 Upvotes

72 comments sorted by

View all comments

Show parent comments

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:

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.

0

u/JimDabell May 06 '20

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.

1

u/[deleted] May 06 '20

Not all projects are version-controlled.

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.

0

u/JimDabell May 06 '20

a sub-subset of projects

You're describing the norm as if it were an extreme minority. Why?

1

u/[deleted] May 06 '20 edited May 06 '20

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.