Skip to content

Bug: Usage of mutable default arguments #72

@adityamahapatra

Description

@adityamahapatra

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions