← BYTES
Python·Starter·Ref: 6.1.19

What is the purpose of a docstring (a triple-quoted string placed immediately after a `def` or `class` line)?

Have a question about this video? Mention reference 6.1.19 when you contact us.

a.It documents the function/class and is accessible at runtime via `help()` or the object's `__doc__` attribute
b.It is a comment that the interpreter completely ignores
c.It is required syntax for every function definition
d.It defines the function's return type
Unlike a `#` comment, a docstring is a real string literal stored as the function/class's `__doc__` attribute, which is what `help(my_function)` displays and what documentation-generation tools extract -- genuinely accessible metadata, not just a visual comment.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES6119#Python