this post was submitted on 05 Apr 2025
24 points (92.9% liked)

Python

7028 readers
1 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

๐Ÿ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

๐Ÿ Python project:
๐Ÿ’“ Python Community:
โœจ Python Ecosystem:
๐ŸŒŒ Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
 

Was going through a Python tutorial, but it seems kinda dated. Wanted to know if people regularly use docstrings in the workforce. Or are they somewhat irrelevant because you can convey most of that info via comments and context? Do jobs make you use them?

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 9 points 2 weeks ago

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.