What are docstrings? How are they useful?

 

Answer:

A docstring is just a regular python triple- quoted string that is the first thing in a function body or a module or a class. They provide a convenient way of associating documentation with Python modules, functions, classes, and methods. 

They are useful because they explain features in an easily comprehensible way.

Ask a doubt
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.