On Mon, Jul 13, 2020 at 11:15 AM Rob Cliffe <[email protected]> wrote:
> On 13 Jul 2020, at 05:55, Christopher Barker <[email protected]> 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. -CHB -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
_______________________________________________ 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/LJRVCD54G7IUMTX5HUADOJS5URRYWBQQ/ Code of Conduct: http://python.org/psf/codeofconduct/
