FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
programmingWithPythonCode/syntax/function.py at main · thomasWeise/programmingWithPythonCode · GitHub
thomasWeise
programmingWithPythonCode
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
programmingWithPythonCode
/
syntax
/
function.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (18 loc) · 940 Bytes
Breadcrumbs
programmingWithPythonCode
/
syntax
/
function.py
Copy path
File metadata and controls
23 lines (18 loc) · 940 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""The syntax of function definitions and function calls."""
def
my_function
(
param_1
:
type_hint
,
param_2
:
type_hint
)
->
result_type
:
"""
Short sentence describing the function.
The title of the so-called docstring is a short sentence stating
what the function does. It can be followed by several paragraphs of
text describing it in more detail. Then follows the list of
parameters, return values, and raised exceptions (if any).
:param param_1: the description of the first parameter (if any)
:param param_2: the description of the second parameter (if any)
:returns: the description of the return value (unless `-> None`).
"""
body
of
function
1
body
of
function
2
return
result
# if result_type is not None we return something
normal
statement
1
# some random code outside of the function
normal
statement
2
my_function
(
argument_1
,
argument_2
)
# We call the function like this.
Back
|
FazBrowse Home
|
New Git URL