I was skimming through the code and came across a bug. In the generic template module, there's a GenericTemplate class that contains the add_template function. The function contains a kwarg, buttons, which defaults to an empty list. Using a mutable object as a default argument has unintended consequences and should be avoided.
Recommendation
This is from the official Python docs: Function definitions.
Refer to the definition of the whats_on_the_telly function under this section.
Description
I was skimming through the code and came across a bug. In the generic template module, there's a GenericTemplate class that contains the add_template function. The function contains a kwarg, buttons, which defaults to an empty list. Using a mutable object as a default argument has unintended consequences and should be avoided.
Recommendation
This is from the official Python docs: Function definitions. Refer to the definition of the whats_on_the_telly function under this section.
Context
The issue is described in further detail here: Avoid mutable default arguments.
I haven't gone through the entire code base so can't say if this is the only instance or not.
Cheers, Aditya