24
Are docstrings commonly used?
(programming.dev)
Welcome to the Python community on the programming.dev Lemmy instance!
Past
November 2023
October 2023
July 2023
August 2023
September 2023
Yes, use them. One big advantage is if you hover something in an IDE it will show you the docstring.
If you're writing Python you should be using Pylint (or Ruff) and it has a lint to ensure you write them.
The exception I usually make is for class member variables because it's super weird that the docstring comes after the variable. I think that's very confusing for people reading the code so I normally just use comments instead.