aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2021-07-23 10:40:52 +0100
committerGravatar Chris Lovering <[email protected]>2021-07-23 10:40:52 +0100
commita2592d0b205e43c676106258a059df13a99fd191 (patch)
tree825163daa396efa82a5471c42be5584a891c6e23
parentMerge pull request #1686 from NotFlameDev/patch-1 (diff)
update docstring command to use 4 space indents.
-rw-r--r--bot/resources/tags/docstring.md21
1 files changed, 11 insertions, 10 deletions
diff --git a/bot/resources/tags/docstring.md b/bot/resources/tags/docstring.md
index 9457b629c..33452b998 100644
--- a/bot/resources/tags/docstring.md
+++ b/bot/resources/tags/docstring.md
@@ -1,17 +1,18 @@
A [`docstring`](https://docs.python.org/3/glossary.html#term-docstring) is a string with triple quotes that often used in file, classes, functions, etc. A docstring should have a clear explanation of exactly what the function does. You can also include descriptions of the function's parameter(s) and its return type, as shown below.
```py
def greet(name, age) -> str:
- """
- Return a string that greets the given person, including their name and age.
+ """
+ Return a string that greets the given person, including their name and age.
- :param name: The name to greet.
- :type name: str
- :param age: The age to display.
- :type age: int
- :return: String of the greeting.
- """
- return_string = f"Hello, {name} you are {age} years old!"
- return return_string
+ :param name: The name to greet.
+ :type name: str
+ :param age: The age to display.
+ :type age: int
+
+ :return: String of the greeting.
+ """
+ return_string = f"Hello, {name} you are {age} years old!"
+ return return_string
```
You can get the docstring by using `.__doc__` attribute. For the last example you can get it through: `print(greet.__doc__)`.