(PYL-W0102) Dangerous default argument
Closed this issue · 3 comments
Description
Do not use a mutable like list
or dictionary
as a default value to an argument. Python’s default arguments are evaluated once when the function is defined. Using a mutable default argument and mutating it will mutate that object for all future calls to the function as well.
Occurrences
There is 1 occurrence of this issue in the repository.
See all occurrences on DeepSource → deepsource.io/gh/edualgo/eduAlgo/issue/PYL-W0102/occurrences/
Hi, can you assign me this issue?
Hey @Abhijit2505
Can you assign the issue to me.
I will fix the mutability issue in edualgo/heaps.py
by replacing def __init__(self, items=[]):
with either def __init__(self, items=None):
OR def __init__(self, items=(None,)):
@Audarya07 sorry, we follow first come first serve.