On Dec 12, 2019, at 10:19, Ricky Teachey <[email protected]> wrote:
>
>>
>>> As an aside, I've occasionally wished that [] would be the same as [()], by
>>> analogy to [1,2].
>>
>> In that universe, would (((((),),),),) be the same as ()?
>
> Sorry: I suppose what I meant was: ((((())))) would be the same as ().
It already is the same:
>>> ((((()))))
()
So presumably it would still be the same in that universe. :)
I don’t see any problem with a[] being the same as a[()]. We already have a[1,]
is the same as a[(1,)] rather than a[1], and this case wouldn’t even have that
potential for confusion.
There are presumably historical reasons why it turned out this way, but if you
were designing a new language that had tuple and slice and ellipsis indexing
like current Python, would you expect [] to be anything other than [()], or
find it confusing?
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/27AIIYXS3GNAIZX3VBH3Q5HOXLDCB2HW/
Code of Conduct: http://python.org/psf/codeofconduct/