On Sun, Oct 10, 2021 at 3:05 PM Finn Mason <[email protected]> wrote: > > On Sat, Oct 9, 2021, 9:56 PM Steven D'Aprano <[email protected]> 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 _______________________________________________ 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/VFQ4LPRXHRMY5IKRAUPMSHLRHGKSWEFY/ Code of Conduct: http://python.org/psf/codeofconduct/
