|
|
|
|
|
by kerkeslager
806 days ago
|
|
> You're proposing that the interpreter add a check for every default parameter in every function signature No, that's not what I'm proposing. Why would it check anything? Just evaluate the given default expression at call time. If you don't want the overhead of an expression, don't put a default. You can also do defaults like: LIST_OF_X = []
def foo(xs = LIST_OF_X):
...
...if you want the other behavior. This does add a variable lookup (oh no!). |
|