What are you talking about? Never had a single issue. More often I've had to deal with someone else's bug induced by adding just 3 spaces instead of 4 in an indentation.
def some_function(self, request):
self.requests += 1 # record request
if self.response is not None:
self.responses += 1 # keep in sync with self.requests
How are you supposed to keep those comments aligned if the lines start with variable-width tabs?
First - the example was not about the content of the comment. It was about the format, as in, spaces vs. tabs. By criticizing the example based on your opinions about the content of the comment, you have failed (deliberately or not) to address the issue for which it was presented.
But to humor you and to address your proposition that comments are only legitimate if they are lengthy, here is a revised example:
def some_function(self, request):
self.requests += 1 # see bug report 1,840
if self.response is not None:
self.responses += 1 # see bug report 1,919
Are you really going to take the position that those comments are necessarily superfluous because they are brief?
I'm going to predict your next argument: "They should be on their own line, because otherwise they might not be aligned due to variable-width tabs" - which would, of course, be solipsistic: your personal preferences for tabs does not conflict with any legitimate examples, and this example is de facto illegitimate because it conflicts with your personal preference.
Finally, since PEP8 has been cited as an authority, I'll just point out this portion about proper comments:
9
u/TheAcanthopterygian Apr 30 '20
So wrong!
Mixing tabs and spaces is a perfect recipe for broken indentation AND painful editing.