On Sat, Nov 30, 2019 at 06:16:49PM -0300, Soni L. wrote: > It'd be quite nice if dict.items() returned a namedtuple so all these > x[0], x[1], el[0], el[1], etc would instead be x.key, x.value, el.key, > el.value, etc. It would be more readable and more maintainable.
If you are doing for item in somedict.items(): process(item[0]) process(item[1]) you could do this instead: for key, value in somedict.items(): process(key) process(value) Does that help? -- Steven _______________________________________________ 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/4NGJCWRNFJOB4LGREWCFWFWHYRQND5OU/ Code of Conduct: http://python.org/psf/codeofconduct/