Source: 📖 Effective Python item 24
Default arguments are only evaluated when the module loads. This can create surprising results when a default value needs to be evaluated each time the function is called, such as a datetime.now()
default value. To circumvent this, assign the default value to None
and use the following syntax to force the default argument to be evaluated each time the function is called.
if keyword is None:
keyword = datetime.now()