Docstring
Now, let's create the function's docstring (documentation string).
Docstring in Python is a documentation string that is used to describe the purpose and behavior of a function, module, or class. It is a string that is placed at the beginning of the function or module or class, enclosed in triple quotes """...""" and can span multiple lines:
Let's look at the PyCharm hint:
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/aa507197-48a5-468a-be93-fbdfa15bb987/Section_2/pyCharm_Docstring.png)
How this hint looks without docstring:
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/aa507197-48a5-468a-be93-fbdfa15bb987/Section_2/pyCharm_notDocstring.png)
The docstring is a brief description of your function.
Note
Annotations and Docstrings are used in real development. Some simple actions can save a lot of time for other developers.
Everything was clear?
Course Content
Mastering Python: Annotations, Errors and Environment
Mastering Python: Annotations, Errors and Environment
Docstring
Now, let's create the function's docstring (documentation string).
Docstring in Python is a documentation string that is used to describe the purpose and behavior of a function, module, or class. It is a string that is placed at the beginning of the function or module or class, enclosed in triple quotes """...""" and can span multiple lines:
Let's look at the PyCharm hint:
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/aa507197-48a5-468a-be93-fbdfa15bb987/Section_2/pyCharm_Docstring.png)
How this hint looks without docstring:
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/aa507197-48a5-468a-be93-fbdfa15bb987/Section_2/pyCharm_notDocstring.png)
The docstring is a brief description of your function.
Note
Annotations and Docstrings are used in real development. Some simple actions can save a lot of time for other developers.
Everything was clear?