• 5 Posts
  • 635 Comments
Joined 2 years ago
cake
Cake day: August 9th, 2023

help-circle





  • MichaltoPythonAre docstrings commonly used?
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    7 days ago

    Docstrings are important and their role is different than comments. They give an overview how the function works, explain parameters and sometimes give examples how to use them. You can generate documentation using sphinx from Docstrings, and as others said IDEs use docstrings to show you information about function you’re using.

    Comments are just text that gets ignored by interpreter. You can add explanation to code if it’s not self explanatory, but they’re not useful outside of the immediate area being commented on.

    Other languages also have documentation options that is separate from comments, e.g. JavaDoc. The syntax is usually similar to coment, but slightly different to differentiate it from comments (extra * in multiline comment).














  • If you answer in the language you know best, it’ll be easier to others to understand or translate, especially if it’s English.

    You could translate your message to match the language of the comment, but if you don’t know the language, how can you know if it conveys your message correctly?

    Overall, I’d say it depends on the specific community. If you try to inject yourself into a conversation in a Japanese language community, it may indeed come off as rude or ignorant.

    The best solution may be to post in both languages?