On Sat, Sep 26, 2020 at 8:40 PM Steven D'Aprano <st...@pearwood.info> wrote:
> On Sat, Sep 26, 2020 at 01:47:56PM -0300, Sebastian Kreft wrote: > > > In this fashion have you considering having keyword only indices, that is > > to only allow either obj[1, 2] or obj[row=1, col=2] (if the class > supports > > it), and disallow mixing positional and keyword indices, meaning obj[1, > > col=2] would be a SyntaxError. > > That would severely reduce the usefulness of this feature for me, > probably by 80 or 90%, and possibly make it useless for xarray and > pandas. > > (I don't speak for the pandas or xarray devs, I'm happy to be > corrected.) >From my perspective as a developer for both xarray and pandas, both "mixed" and "keyword only" indexing have use cases, but I would guess keyword only indexing is more important. In xarray, we currently have methods that awkwardly approximate keyword only indexing (e.g., xarray.DataArray.sel() and xarray.DataArray.isel() both allow for named dimensions with **kwargs), but nothing for the "mixed" case (neither method supports positional *args).
_______________________________________________ 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/IPEP5YXUQKCNCARJH4NKF7I757M7XLCA/ Code of Conduct: http://python.org/psf/codeofconduct/