3 ms·
I agree that it's unfortunate that this is the default behaviour. It's just so unexpected when first encountered. That said, it is not always desirable that a
by aix1 5y ago
I agree that it's unfortunate that this is the default behaviour. It's just so unexpected when first encountered.
That said, it is not always desirable that a new object is created each time the function is called without the arg. One obvious example is when the default is an immutable object that's either large or expensive to construct.