You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered: