Module 6: Functions Fundamentals and Best Practices¶
In this module you will expand your knowledge on functions and the best practices when developing functions and code.
Module Learning Outcomes¶
By the end of the module, students are expected to:
Evaluate the readability, complexity and performance of a function.
Write docstrings for functions following the NumPy/SciPy format.
Write comments within a function to improve readability.
Write and design functions with default arguments.
Explain the importance of scoping and environments in Python as they relate to functions.
Formulate test cases to prove a function design specification.
Use
assert
statements to formulate a test case to prove a function design specification.Use test-driven development principles to define a function that accepts parameters, returns values and passes all tests.
Handle errors gracefully via exception handling.