On Mon, Jul 13, 2020 at 11:15 AM Rob Cliffe firstname.lastname@example.org wrote:
On 13 Jul 2020, at 05:55, Christopher Barker email@example.com wrote:
In fact, I doubt there are many uses at all for dict.keys() -- most uses can jsut use the dict.
But you could use items() instead: for name, val in sorted(dict.items()): print(name, val)
Sure. But my point was that the dict_keys object is very often unnecessary, not that all the views aren't useful. And it really is mostly only there for symmetry with dict_items(), which IS needed.
I'm on the fence though -- I think it adds clarity, even if it's unnecessary.