Skip to content

Conversation

abhinav-upadhyay
Copy link

Using a mutable object, such as [] as the default value of a function parameter is an anti-pattern in Python because the same object is shared across all calls to that function.

Even though in this case the __init__ method was simply iterating over the list, it is better to be safe.

Using a mutable object, such as `[]` as the default value of a 
function parameter is an anti-pattern in Python because the
same object is shared across all calls. 

Even though in this case the `__init__` method was simply
iterating over the list, it is better to be safe.
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 this pull request may close these issues.

1 participant