
On 27/10/2021 08:56, Chris Angelico wrote:
On Wed, Oct 27, 2021 at 5:14 PM Brendan Barnwell <brenbarn@brenbarn.net> wrote:
But I still think it's worth noticing that the new syntax is not going to add a "full dimension". It is only going to be useful for VERY SIMPLE late-bound default values. If the late-bound default is too complicated, inlining it will backfire and make things LESS readable. So although the syntax is orthogonal, it is not really separating out early and late default binding; it is only separating "simple late default binding". And that right there is the crux of it. The simple cases ARE quite common. Of course there will always be cases that don't work that way, so yes, there will always be the need to use sentinels and put the logic inside the function; but there are plenty where code will benefit from putting the default into the signature, just as we already have with early-bound defaults.
It's easy to argue against a feature by showing that it can be abused.
+1. The same argument (Brendan's) could be used against having e.g. list comprehensions. Rob Cliffe