Python – Docstring – Help and Comments
Docstrings in Python are actually quite simple – the are 3 times this “”” and the code between opening and closing them can be formatted in any possible way.
The reason I have decided to dedicate a whole article to them (other that I probably do not have anything better to do) is that they can be called through the help() function of python.

Let’s see how it works. Imagine the following file:
"""
This is an example of what can be done with docstrings.
"""
print("Thank you for using VitoshAcademy.com!")
class Blog:
"""This is a class that represents a blog."""
def __init__(self, name, scope):
self.name = name
self.scope = scope
self.articles = 42
def count_articles(self):
# The number of articles is actually a default one.
return self.articles
def __repr__(self):
# representing the blog with 1 sentence.
return f"A nice blog named {self.name} with {self.count_articles()}"
if __name__ == "__main__":
new_blog = Blog("vtoshacademy.com", "IT")
print(new_blog.count_articles())
print(new_blog)
If we navigate to the folder of the file and open python, then we may use the magic words import vitoshacademy. As we have the words print(“Thank you for using VitoshAcademy.com!”) ย on the top of the module, we will see the following:

Which actually can make you smile a bit. Furthermore, once imported, we may start using help():

To return back to Python from vim, press :q or google “how to exit vim”. If you want to display the help of specific function, then its class should be imported (if applicable) and is should be referred:

If you want to refer to the comment in a function, then the __doc__ is your friend, so that the following:
print(new_blog.count_articles.__doc__)
returns:

So, that should be it. Thanks for reading ๐