On Tue, Jul 21, 2020 at 2:05 PM David Mertz <mertz@gnosis.cx> wrote:
On Tue, Jul 21, 2020, 12:14 PM Sebastian Berg
First, using it for named dimensions, means you don't actually need to mix it with normal tuple indexing, mixing both seems rather confusing?
temperature.loc(method="nearest")[longitude=longs, latitude=lats]
[*] In my opinion, passing the keyword argument using anything other than the standard **kws style sounds crazy. We have perfectly good ways to do that for every other function or method. Don't invent something new and different that only works with .__getitem__().
It would also be possible to pass __getitem__ exactly one other argument, a dict with all the named arguments. So instead of __getitem__(inds, **kwargs) simply __getitem__(inds, kwargs) "kwargs" would be the same in both cases, a dict with the key/value pairs. In most cases a dict is what people are going to want anyway. It avoids having to unpack then repack the dict. But it would make it slightly harder for adding parameters to indexing, although I am skeptical of that use-case to begin with. It would also make it feasible to use labels that aren't valid variable names, although it may not be desirable to support that.