Check sibling questions

How are docstring different from comments?

 

Answer:

Docstrings

Comments

They are used to describe functions and classes and show what parameters they accept and what they return.

They are used to explain the working of a code and sometimes to exclude a bit of code without removing it.

The docstring of a certain method or class can be viewed using the help( ) function.

Not visible while executing the code.

 

Are ads bothering you?

CA Maninder Singh's photo - Expert in Practical Accounts, Taxation and Efiling

Made by

CA Maninder Singh

CA Maninder Singh is a Chartered Accountant for the past 12 years. He also provides Accounts Tax GST Training in Delhi, Kerala and online.