-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathexample.py
More file actions
23 lines (18 loc) · 831 Bytes
/
example.py
File metadata and controls
23 lines (18 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
An example module
:author: Daniel Abercrombie <dabercro@mit.edu>
"""
def example_function(an_integer, a_string, int_or_str):
"""My example function for the developer guidelines.
:param int an_integer: This is a description for what an integer can be used for
:param str a_string: This is a description for what a string can be used for
:param int_or_str: This is just an example for more complex variables types
:type int_or_str: int or str
:returns: The number 0
:rtype: int
:raises TypeError: If any of the variables are the wrong type
"""
if not (isinstance(an_integer, int) and isinstance(a_string, str)
and (isinstance(int_or_str, int) or isinstance(int_or_str, str))):
raise TypeError('At least one of the input variables is the wrong type.')
return 0