Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Write Python Docstrings Effectively (Summary)

In this video course, you learned how to:

  • Access a docstring at runtime using the .__doc__ attribute
  • Follow conventions for one-line and multiline docstrings described in PEP 257
  • Format docstrings by using triple double quotes (""")
  • Use common docstring formats like reStructuredText, Google-style, NumPy-style, and doctest-style
  • Avoid docstring antipatterns like vague descriptions, inconsistent formatting, and missing return value explanations

With effective docstrings, you help readers and tools understand your code, prevent misunderstandings, and reduce the risk of bugs.

Resources mentioned in this lesson:

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Already a member? Sign-In

00:00 Congratulations on completing “Write Python Docstrings Effectively”. You’ve learned a lot, from the conventions laid out in PEP 257, to the various styles in use by the community, and even rehabilitating poorly written docstrings.

00:13 You can pretty much say you’re a doc-string wizard at this point. After all, docstrings are our most inexhaustible source of magic.

00:21 In this course, you learned to understand the purpose of docstrings, differentiate between docstrings and comments, recognize and write Python docstrings in common formats, avoid common pitfalls when writing docstrings, and choose the appropriate docstring format for modules, classes, and functions.

00:39 If you’re itching for more, why not have a read through the tutorial? This course is based on “How to Write Docstrings in Python”, with even more content and examples.

00:48 Or for something a little different, “Writing Beautiful Python Code with PEP 8” walks you through a classic Python Enhancement Proposal and gives you the tools to apply it to your everyday code writing.

00:59 Alternatively, “Object-Oriented Programming in Python” is great if you’re ready to learn more about writing classes, and using an object-oriented approach to Python development.

01:08 But if you’re interested in learning more about Python internals, especially its type system, you can’t go wrong with “Getting to Know Duck Typing in Python”.

01:18 This has been Joseph. Thanks for watching. Mischief managed.

Become a Member to join the conversation.