4 ms·
> the mutable default arguments problem is quite difficult to solve in any other way. Python never copies things for you. Why would it be a problem to do a cop
by lovasoa 6y ago
> the mutable default arguments problem is quite difficult to solve in any other way. Python never copies things for you.
Why would it be a problem to do a copy in this case?
> f(x) always gives you the value of applying f to x
Not if it is preceded by "def"
> | means bitwise or.
Not if it had been overloaded, like many popular libraries do.
> a means the value of a
Not if it is followed by "="
How is that different from the new pattern matching syntax ?
- toxik 6y ago> Why would it be a problem to do a copy in this case? How are copy semantics even defined unambiguously? > Not if it is preceded by "def" In that case it is analogous, def f(x) DEFINES what f(x) means. For class definitions it's different, and it is indeed debatable if `class A(SuperClass)` is good syntax. I would have preferred `class A from SuperClass`, but that ship has sailed. > | means bitwise or. Not if it had been overloaded, like many popular libraries do. You missed the point willingly I think. See sibling comment. You cannot overload its meaning in a match, and the meaning is not related to what it otherwise means (bitwise or, set union, etc.). > a means the value of a Not if it is followed by "=" And again, this is by analogy. a = 1 means that you substitute a with 1 wherever a occurs. Not so with the pattern matching syntax. If we had a = 1 then a == 1. Where is this analogy for pattern matching? How do you even make the comparison? You do not. All of your counterpoints have reasonable analogies within the syntax itself (eg: the inverse of a function call is a function definition).