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?

  • TootSweet@lemmy.world
    link
    fedilink
    English
    arrow-up
    9
    ·
    2 days ago

    Yup, use docstrings and be descriptive. Learn by reading docstrings in other codebases. (Django’s codebase is always an excellent example of how to do Python, including how to do docstrings.) a) Anyone who sees your code will thank you and b) if you can’t explain it in human language, you probably don’t understand it well enough to implement it well.