On Fri, Jul 17, 2020 at 9:22 PM Ricky Teachey <ricky@teachey.org> wrote:
# The positional arguments aren't part of the KeyObject d[a, b:c, d, e=5, f=6] == d.__getitem__((a, b:c, d), KeyObject(e=5, f=6))
This raises a question that needs to be answered, then: what would be the utility of mixing together positional and kwd arguments in this way?
Even the xarray examples given so far don't seem to make use of this mixture. From my knowledge of pandas I am not sure what the meaning of this would be, either.
One use case that comes up in xarray and pandas is support for indicating indexing "modes". For example, when indexing with floating point numbers it's convenient to be able to opt-in to approximate indexing, e.g., something like: array.loc[longitude, latitude, method='nearest', tolerance=0.001] (This use case is actually already mentioned in PEP 472, as "an optional contextual to the indexing": https://www.python.org/dev/peps/pep-0472/#use-cases)