On 2025-12-18 18:00:45 +0000, Richard Kettlewell wrote: > Peter Flass <[email protected]> writes: > > I comment *A LOT*. When I had to go back and revisit some very old > > code, I wished I had commented more. I've almost never looked at a > > program and said "I wish it had fewer comments." > > Regrettably, I’ve encountered plenty of comments that don’t actually > reflect the code (for a variety of reasons).
As a wise man once said,
"If the comments and code disagree, both are probably wrong."
> I’ve also encountered quite a few comments written by people who had
> been instructed to add comments to under-commented code, but didn’t
> really understand what they were looking at.
A large proportion of the comments I write are on somebody else's code.
And I write them precicely because I don't understand the code. So I
leave notes while trying to figure it out. Once I have figured it out, I
delete a lot of these comments again, because a) they aren't that
illuminating to a future reader, b) they aren't always polite to the
original programmer, and c) I rewrite the code anyway to make it more
readable.
hjp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | [email protected] | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman3//lists/python-list.python.org
