Featured

Mutable Objects for Function Default Values & Class Attributes

Function Argument Default Values Using mutable objects as default values, is often included in common pitfalls when using Python. We list some examples of unexpected behaviour and how to avoid mistakes. Python 3.6.8 is used in the following code samples. We define a function that appends a number to a list, under certain conditions. Now, … Continue reading Mutable Objects for Function Default Values & Class Attributes

Advertisements