On Dec 12, 2019, at 11:14, Ricky Teachey <ri...@teachey.org> wrote: > > 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?
That’s not even about subscripting syntax, it’s about calling syntax, and I can’t see why you’d want to change that (or change how type.__call__ delegates to __new__ and __init__, or give tuple a weird metaclass that overrides that, or anything else relevant) just because you changed subscripting. So t would be the first argument, the same as always. If you want 1 to be the first argument, you have to write MyWeirdTuple(*t). _______________________________________________ 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/QWAX7JOJ63TU6VM5RTTM6ABHOHAZDRN5/ Code of Conduct: http://python.org/psf/codeofconduct/