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? > Actually just realized I definitely did get it wrong: def __getitem__(self, key=MISSING, time=MISSING, money=MISSING): if time is MISSING or money is MISSING: if time is not MISSING and key is not MISSING: money, key = key, MISSING elif money is not MISSING and key is not MISSING: time, key = key, MISSING elif time is MISSING and money is MISSING: (time, money), key = key, MISSING if key is not MISSING: raise TypeError() Still not sure if that is right.
_______________________________________________ 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/HISY3CUPKUBV6TJEHXNANIKJL4IGVUEW/ Code of Conduct: http://python.org/psf/codeofconduct/