I am following the Python tutorial and at some point they talk about how the 1st statement of a function can be a String Literal. As far as the example goes, this String Lit
A string literal is a string in one of the many quoting options, that is not assigned to a variable.
So,
"String" # string literal
'string' # string literal
"""
Multiline
String
Literal
"""
foo = "string variable"
When you have a string literal immediately after a def block, it becomes part of the documentation for that method, and is called a docstring
def foo(hello):
"""This is part of the documentation for foo"""
This is how you would use it:
>>> def foo(hello):
... """This is the docstring"""
... pass
...
>>> foo.__doc__
'This is the docstring'