Re: Python

"Peter J. Holzer" <[email protected]> Sun, 21 Dec 2025 13:33:18 +0100
Newsgroups gmane.comp.python.general
Message-ID <legz46vr2ujmrx2rcypmgqrxvmui2phfhhmnldtuznu56uoqz4@vmmaawe2uloj>
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 (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmlH6QUACgkQ8g5IURL+
KF3ThQ/9GF0xDKowPgznBcJJLSnNk6Biry+Po4zaZBRNh1zcFWcqNicMYWbGAAYM
MDf/UAJ+UyEIEJG2LjvBzqru7drA/uGpif+A7rUf3MMUiF2vH01sa1aOLcjPASei
OShbTXoVqgFyCls+eALc7qmIoWf3nRFV6W6yakAv35zBSmlYW5gVUHYBIceOz1e8
3gfjuzrs4MKIP2+h2cmnbvtAKgSuYcXjxaoMCqZ093TMA0543oMIUyhpZbvl5t8n
J9yM0Tn8v1TK7+JtqiqgPY8kpVVNogiMXA+bUcZ+DG7qIV60UghRgTVDRCj6gk4F
OB3+SmdVVDVy0y55rgY+dR3/+ICnhzxUyH65N3C1yZZ7Ns8xmM+p2za63M8UXAIj
6k4GSeaO9hRpWC/ie0iQAQIRGYMn5xO+PakZjEKNVpMGnJI4TLzVaRvFZDiiYtcm
elog3pAChAsLgobhwa8BPIAaUZplJ53EErF88N8zaXDazCVsmb15FdV8WDWur8aM
wkksdTcL4ryd2zd0y/2N31LgrICr6ixVUIhfSqNpeuM5VqK3pBSAidUPVTjJ7yHM
nlg2hqfxIsHCTiOwz34ilO4R7Juri4dHzI+w20PfHwM2Id7VCn3wbhD8i3n14sJ0
zFqBf4mpnAS5QTgbsda2V5UvLT+peSCfXbQ5jZ84Za3MdoKSAQc=
=lBJX
-----END PGP SIGNATURE-----