
On Sun, Apr 19, 2020 at 02:30:21PM +1200, Greg Ewing wrote:
On 19/04/20 7:17 am, Alex Hall wrote:
there is something about all these examples (plausibility?) that feels distinctly different from your proposal.
To me it seems like an unnecessarily complicated syntax that goes out of its way to look deceptively like something else.
Are we still talking about `**{identifier}`? There are three tokens there: `**{`, an identifier, and `}`. Adding an optional comma makes four. If this is your idea of "complicated syntax", I cannot imagine how you cope with function definitions in their full generality: def name(arg, /, a:str='', *args, b:float=-0.0, **kw) -> str:
f(a, b, c)
x = a, b, c f(x)
This imagined refactoring doesn't feel as plausible. A complete beginner might think that they can do that, but a programmer who knows what tuples are can reason that it doesn't make sense.
Fun fact -- I gather there was a very early version of Python in which this refactoring *did* work. But it was quickly changed because people found it too confusing!
I can confirm your fun fact is true in Python 0.9.1, at least the first part. I don't know if it was changed because people were confused, or if they just didn't like it, or because it made it troublesome to pass a tuple as argument.
I think what's happening here is that long experience with other languages has ingrained in us the idea that commas separate arguments to a function without creating tuples, so when we see a comma-separated list in the context of a function call we instinctively think "argument list" and not "tuple".
But there is no such precedent for the OP's proposal.
You just spent an entire paragraph describing such a precedent. -- Steven