LLM-generated docs are usually worthless

Hot take!

This has always been true, but it begs repeating:

Every docstring should provide additional information about the thing that it is documenting, which is not obvious from the thing’s name and its type information.

And the corollary:

If an LLM could generate the same docstring for you, based on the name and type information alone, then the docstring is not adding any value.

This applies independent of whether it was actually written by a LLM, or whether you yourself just mindlessly filled in the blanks without thinking.

Writing a docstring is supposed to make you think.

Comments