MENU
Question -

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. When executing a functionbody the docstring does not do anything like comments, but Python stores it as part of the function documen-tation. This documentation can later be displayed using help)) function. So even though docstrings appear like comments but these are different from comments.

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×