Functions' side effects
Last updated
Last updated
In the video below, we will talk about the side effects of function calls in Python. Side effects are any changes that a function makes to the state of the program or the environment outside of its own scope. For example, a function that writes to a file, or modifies a global variable has side effects. Side effects are not necessarily bad, but they can make your code harder to understand, test, and debug.
In general, it is good practice to minimise the side effects of your functions and make them as pure as possible. A pure function is one that only depends on its input parameters and returns a value without changing anything else. Pure functions are easier to reason about, reuse, and optimise.