Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Usage of mutable default arguments #72

Open
adityamahapatra opened this issue Oct 27, 2020 · 1 comment · May be fixed by #79
Open

Bug: Usage of mutable default arguments #72

adityamahapatra opened this issue Oct 27, 2020 · 1 comment · May be fixed by #79

Comments

@adityamahapatra
Copy link

adityamahapatra commented Oct 27, 2020

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

@okayjones okayjones linked a pull request Apr 30, 2021 that will close this issue
@okayjones
Copy link

Opened up a small PR for this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants