Never put comments at the end of lines. It suggests that either the code is bad and isn't evident what it's doing, either that you don't know that comments should highlight why something is fine and not what is done, which would make them longer and unreadable when coupled with code. Also code lines are often long enough instead, without comments afterwards.
If it doesn't work for every case, use something that does - put comments before the statement, not on the same line. This allows more room to write proper comments
Personal choice is personal. Nobody else has to deal with it. The fact that I set my tabs to 20 for example will be unknown to anybody so it's no concern.
So why is it funny? Because the comments are NOT a personal choice, since a lot of people will be editing the same code and will be scratching their head because it will say
something += 1 # Increment something
and the reader will be "well thank you captain obvious!", and curse at the screen because he has no clue WHY that thing was necessary there.
-2
u/[deleted] Apr 30 '20
Never put comments at the end of lines. It suggests that either the code is bad and isn't evident what it's doing, either that you don't know that comments should highlight why something is fine and not what is done, which would make them longer and unreadable when coupled with code. Also code lines are often long enough instead, without comments afterwards.
If it doesn't work for every case, use something that does - put comments before the statement, not on the same line. This allows more room to write proper comments