>   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. :)
>

How embarrassing.


>
> 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?
>
>
But what would happen if you call a user-defined class with a tuple as an
argument?

class MyWeirdTuple(tuple):
    def __new__(self, tup, *args): ...

t = (1,2,3)
tuple(t)  # returns (1,2,3)
MyWeirdTuple(t)  # is t the first argument, or is 1 the first argument?
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/UP7IGWNJ5MCIMUATMPPCXEZE3IXXIBVW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to