On Tue, Sep 1, 2020, 9:20 PM Ricky Teachey <ri...@teachey.org> wrote:
> On Tue, Sep 1, 2020, 9:06 PM Ricky Teachey <ri...@teachey.org> wrote: > >> On Tue, Sep 1, 2020, 8:35 PM Guido van Rossum <gu...@python.org> wrote: >> >>> On Tue, Sep 1, 2020 at 4:57 PM Greg Ewing <greg.ew...@canterbury.ac.nz> >>> wrote: >>> >>>> On 2/09/20 2:24 am, Steven D'Aprano wrote: >>>> > On Sun, Aug 30, 2020 at 05:49:50PM +1200, Greg Ewing wrote: >>>> >> On 30/08/20 3:06 pm, Steven D'Aprano wrote: >>>> >>> On Thu, Aug 27, 2020 at 11:13:38PM +1200, Greg Ewing wrote: >>>> >>> >>>> >>>> a[17, 42] >>>> >>>> a[time = 17, money = 42] >>>> >>>> a[money = 42, time = 17] >>>> > >>> >>> I agree it's a fine use case. Using the currently prevailing proposal >>> (which I steadfastly will refer to as "Steven's proposal") it's quite >>> possible to implement this. >>> >> >>> -- >>> --Guido van Rossum (python.org/~guido) >>> >> >> Can someone tell me... >> > >> Is this right? Wrong? The hard way? The slow way? >> > > ...Still not sure if that is right. > Actually I suppose this is the best way to do it: def _real_signature(time, money): ... class C: def __getitem__(self, key, **kwargs): try: _real_signature(*key, **kwargs) except TypeError: try: _real_signature(key, **kwargs) except TypeError: raise TypeError() from None Sorry for all the replies but I'm honestly very unsure how do this correctly under Steven's proposal.
_______________________________________________ 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/MSENNTHMJSU25NOZ5TJ3S2S2VZHQWYRF/ Code of Conduct: http://python.org/psf/codeofconduct/