Reference
Python template with some awesome tools to quickstart any Python project.
python_module_template
Module Docstring.
logger
module-attribute
logger = getLogger('python_module_template')
Calculator
Class for simple calculator operations.
Source code in python_package_template/python_module_template.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
divide
staticmethod
divide(a, b)
Divide a by b.
Parameters:
-
a
(float
) –Dividend.
-
b
(float
) –Divisor.
Returns:
-
float
(float
) –The result of the division.
Raises:
-
ZeroDivisionError
–if b is 0.
-
TypeError
–if a or b are not float numbers.
Examples:
You can run this function as following.
>>> Calculator.divide(2,1)
2.0
Source code in python_package_template/python_module_template.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|