empty dict/list as argument: best practice?
I know that you should do this in this form: fun(a = None): if a is None: a = {} (or a = []) Otherwise each function calls uses the same list/dictionary. I have two examples: first one really needs an empty dictionary: https://code.sololearn.com/cA1cVq8J87qw/?ref=app Because each stored key depends on the sum and array. Another function call with different nums produces a different dictionary. But the fibonacci function would not need it. https://code.sololearn.com/cAke55R5P81K/?ref=app Because Fibonnaci is unique. For example I can call F(10), my dictionary gets filled with some values. Then I can call F(5) and here I could use the already calculated values from calling F(10). But which is best practice: a) it depends? b) use always None and check against None to create an emtpy dict/list? Thanks!