4 ms·
There is no bug... yet. Unless you modify the default argument. Sometimes I just want to monkeypatch the list to be immutable in my app.
by danuker 4y ago
There is no bug... yet. Unless you modify the default argument.
Sometimes I just want to monkeypatch the list to be immutable in my app.
- scwoodal 4y agoI'd consider this a bug and not expected behavior. def make_pizza(crust=THIN, toppings=[], cheese=REGULAR, sauce=TOMATO): // first call: toppings=["peperoni"] // second call: toppings=["peperoni", "sausage"] // third call: toppings=["peperoni", "sausage"] make_pizza(toppings=["peperoni"]) make_pizza(toppings=["sausage"]) make_pizza()