On Mon, Jul 13, 2020 at 11:15 AM Rob Cliffe <rob.cli...@btinternet.com> wrote:
> On 13 Jul 2020, at 05:55, Christopher Barker <python...@gmail.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. -CHB -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/LJRVCD54G7IUMTX5HUADOJS5URRYWBQQ/ Code of Conduct: http://python.org/psf/codeofconduct/