On 18/08/20 6:37 am, Jonathan Fine wrote:
if >>> something[*argv] is allowed, then what was a syntax error becomes a run-time error.
I don't think so. If argv is empty, this is more akin to x = () something(x) which we presumably still want to allow. Opponents of a[] aren't trying to prevent an empty tuple being passed as an index, only disallow that particular way of spelling it. One possible reason for that is because it's not clear whether it should really mean passing an empty tuple or passing no positional argument at all. However, we still have to grapple with that issue if we want to allow keyword-only indexes, and it seems to me that whatever answer we come up with should also apply to a[]. So that's not really an argument against allowing a[]. Another reason put forward is that someone might accidentally type d[] = something and get an unexpected empty tuple in their dict. But I don't see why that's such a heinous possibility that a syntactic restriction is needed to protect us from it. Normal debugging techniques should be adequate to find it. So there don't seem to be any real technical arguments against allowing a[], only ones based on tradition ("we never allow it before") and emotion ("this looks weird and unfamiliar"). -- Greg