edualgo / eduAlgo

A simple python package having modules of different algorithms to use in educational purposes.
https://edualgo.github.io/documentation/
MIT License
99 stars 54 forks source link

(PYL-W0102) Dangerous default argument #164

Closed Abhijit2505 closed 2 years ago

Abhijit2505 commented 2 years ago

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/

LukasBerka commented 2 years ago

Hi, can you assign me this issue?

Audarya07 commented 2 years ago

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,)):

Abhijit2505 commented 2 years ago

@Audarya07 sorry, we follow first come first serve.