On Thu, Jul 30, 2020 at 06:17:24PM -0400, Wes Turner wrote:
> What new syntax do you propose?
I don't propose new syntax. If this functionality is needed, regular
method syntax will do the job without misleading people to th8ink that
dicts are sequences that ought to support the full sequence API or the
full set of list methods. One or the other of these methods should be
sufficient for the uses I've seen:
dict.getkey(index) # return key
dict.getitem(index) # return (key, value)
I'm not even convinced that there is a compelling use-case for this
functionality at all, but one or both of the above seem more than
sufficient. Once you have the key, you can do everything else.
If there is a need to get the insertion index of a key, that could also
be a method, but let's hold off adding that unless there is a good
reason.
--
Steven
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/PKKO4XFUC5BIQZKXMWM2VJGO4GDELYAW/
Code of Conduct: http://python.org/psf/codeofconduct/