Side note: there is a library, scalpl, which does quite a lot of what you want with keys. But they use a slightly different syntax for list items. They might be amenable to adding a JSON schema dialect.
On Wed, 21 Jul 2021, 4:46 pm Paul Moore, <p.f.mo...@gmail.com> wrote: > 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 <svenpvo...@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 <ros...@gmail.com> > wrote: > >> > >> On Thu, Jul 22, 2021 at 1:14 AM Sven Voigt <svenpvo...@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-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/2IOA23Z33434YWPTQWDPMA5RGJBCPCRZ/ > >> Code of Conduct: http://python.org/psf/codeofconduct/ > > > > _______________________________________________ > > 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/BRWPYXYXOFJAY7FKEGTFZO5T7XKBSCZ3/ > > Code of Conduct: http://python.org/psf/codeofconduct/ > _______________________________________________ > 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/UR52XKA2I6AWKCELIDODF5IVBHMHBBW7/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ 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/TJNKWWQ64QUO6YNW47OB3AAHZ7F77Q6X/ Code of Conduct: http://python.org/psf/codeofconduct/