On Sun, Oct 10, 2021 at 3:05 PM Finn Mason finnjavier08@gmail.com wrote:
On Sat, Oct 9, 2021, 9:56 PM Steven D'Aprano steve@pearwood.info wrote:
[Snip...]
Newbies won't know first() lives in itertools, and those experienced enough to know it is there probably won't bother to use it.
A very good point.
Let's get back to the original topic. Should `dict.items()` be indexable now that dicts are ordered? I say yes. Why shouldn't it?
I say no, because dicts may retain order, but still aren't sequences. Under what situations do you actually want the 43rd item out of a dictionary?
Asking for the first or the last MAY make some sense, but asking for arbitrary indexes doesn't really. And if you do, list(d) will give you the keys as a fully subscriptable sequence.
ChrisA