News for hackers. Stuff that matters.
Re:Writing Well-Documented Code – Learn from Examples by komon on Saturday September 04, 2021 @01:13PM (#28416892)
In defense of the first comment, when first approaching a body of code like this, it's not always going to be clear what returning None is going to mean in any given method.

Also, one thing I think doesn't get mentioned enough is the use of comments as anchors for text search. Having "disable limiting" expressed in English that way makes it easier for newcomers to explore the codebase.

Re:Writing Well-Documented Code – Learn from Examples by kyleee on Saturday September 04, 2021 @01:34PM (#28417121)
Good point. Also the phrases in the initial comment "token bucket capacity" and "refill time" may serve as hints and can be used as entry points to searching external documentation.
Re:Writing Well-Documented Code – Learn from Examples by codethief on Saturday September 04, 2021 @03:27PM (#28418257)
I agree, though I think it would be even better if variables were named "token bucket capacity" and "refill time" in the first place.
Re:Writing Well-Documented Code – Learn from Examples by bcyn on Saturday September 04, 2021 @01:42PM (#28417226)
It’s hard to judge out of context. IMO None meaning “disable limiting” should be a docstring/comment at the method level, describing what its return values mean, not inline next to this code.