On Sun, 30 Aug 2020 at 04:09, Steven D'Aprano <st...@pearwood.info> wrote:

> > Nobody disputes that it *could* be made to work that way. But I'm
> > not convinced that it's the *best* way for it to work. The killer
> > argument in my mind is what you would have to do to make an object
> > where all of the following are equivalent:
> >
> >    a[17, 42]
> >    a[time = 17, money = 42]
> >    a[money = 42, time = 17]
>
> I don't think that something like that is exactly the intended use-case
> for the feature, at least not intended by *me*, that looks more like it
> should be a function API.

The above feature is well intended and part of the original PEP,
mostly for two reasons:
1. During my career I encountered issues where people confused the
axis of a matrix. This is especially problematic when the matrix is
symmetric.
2. pandas has this exact problem with column names, and while they
have a workaround, in my opinion it is suboptimal

> But as I mention above, if we did introduce this, I'd rather we keep the
> dunders and change the name rather than introduce confusable names.

that is something it's hard to fight against. unless we call it
something like _extended_getitem_?
getItemEx was proposed by GvR for the C API... it seems to be a
frequent convention.
_______________________________________________
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/ZNX6PB7NI4YIN5SZLVXZDV3QOH46MUVZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to