Maybe your examples aren't making it clear what you're suggesting, then. I'm in agreement with Chris, your "nested iteration tool" sounds like something that would have so many configuration options and parameters that it would be harder to use than traversing "by hand". But maybe you imagine something simpler than I do. Again, can I suggest you post what you imagine the user documentation for the function would look like, and then we'll be able to stop misunderstanding each other? Paul On Wed, 21 Jul 2021 at 16:29, Sven Voigt <svenpvoigt@gmail.com> wrote:
I could say the same thing about JSON dumps then and most itertools functions. The proposed functionality is in line with existing functionality and extends it to the case of nested data structures.
On Wed, Jul 21, 2021 at 11:25 AM Chris Angelico <rosuav@gmail.com> wrote:
On Thu, Jul 22, 2021 at 1:14 AM Sven Voigt <svenpvoigt@gmail.com> wrote:
Paul,
I agree that the mapping to a flat data structure might have limited use cases. However, like you said it is only one example. What I am proposing is a nested iteration tool that can map both keys and values to new keys and new values. It only considers nesting in dictionaries, lists, and tuples by default, but allows users to pass another function to continue searching for pointers in other types.
This sounds like the sort of thing that's best coded up specifically to your purposes. There'll be myriad small variants of this kind of traversal, so it's easiest to just write the thing you want, rather than try to get the standard library to support every variant.
ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/2IOA23... Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/BRWPYX... Code of Conduct: http://python.org/psf/codeofconduct/