3 ms·
> There also wouldn't be this bug where using an empty list as the default value of an optional parameter would do the wrong thing (the same list object is reus
by anamax 15y ago
> There also wouldn't be this bug where using an empty list as the default value of an optional parameter would do the wrong thing (the same list object is reused on subsequent calls, when it is no longer empty).
That's not a consequences of not using "functional collections" - lisp has non-functional collections, yet the empty list doesn't have that behavior.
Note the difference between "an empty list" (correct for python) and "the empty list" (correct for lisp). That reflects a design decision that has consequences. Neither is superior in all circumstances.
In some sense, this is an instance of an overloading error. Python's lists aren't lisp's lists and there are many other definitions.