__doc__
Dunder AttributePython 2.0+Beginner
The docstring of a module, class, method, or function
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.0+
Learn by Difficulty
Quick Example
python
# __doc__ holds the docstring def greet(name): """Greet someone by name.""" return f"Hello, {name}!" print(greet.__doc__) print(list.__doc__[:100])
__doc__ is a special attribute that the docstring of a module, class, method, or function.
Try in PlaygroundTags
oopintrospectioncore