
On 30/06/2020 18:31, Christopher Barker wrote:
The first improvement on that was the iter* methods, and then (inspired by JAVA) it was determined that we could have view objects that could provide efficient iterators, and also set-like behavior. But I don't see any comments in the PEP about why indexing was rejected, but it's implicit in the fact that dicts were explicitly unordered at the time that PEP was written.
I'm sorry, I don't think that logic holds water. Dicts at the time were explicitly unordered (and I still mostly find it more useful to think of them as unordered), but iterators are explicitly ordered. You probably couldn't rely on that order being consistent if you fiddled with the dict between iterations, but that's not behaviour we encourage with list-handling either. Don't get me wrong, if it's not going to cause performance issues I think being able to index views would be great, but I don't think this is the right way to justify it. If anyone who knows could comment on the feasibility, that would be great too :-) -- Rhodri James *-* Kynesim Ltd