On Sat, Aug 15, 2020 at 10:00 PM Steven D'Aprano <st...@pearwood.info> wrote:
> On Sat, Aug 15, 2020 at 08:26:10PM -0700, Guido van Rossum wrote: > > > Are you saying that for xarray it is important to distinguish between > > `d[day=3, detector=4]` and `d[detector=4, day=3]`? If we just passed the > > keyword args to `__getitem__` as an extra `**kwds` argument (which > > preserves order, since Python 3.6 at least), that should work, right? If > > not, can you clarify? > > > Just to clarify here, I assume you mean that if xarray cares about > order-preserving keywords, they should write their methods this way: > > def __getitem__(self, index=None, **kwargs): > > rather than mandating that keyword args are *always* bundled into a > single dict parameter. > Um, I'm not sure what "bundled into a single dict parameter" refers to. That the signature would be ``` def __getitem__(self, index, kwargs, /): ``` ? That sounds bad for people who want to use a few choice keywords. (And I think you'd be against that, for that very reason; as am I.) Or Jonathan Fine's proposal to create a "Key" class that bundles positional and keyword args? Same thing. (And I *know* you're against that. So am I.) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________ 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/J3BBFN56ARRM3VV5TKD5JXM4PDS3VP34/ Code of Conduct: http://python.org/psf/codeofconduct/