[Python-ideas] Nested Dictionary Pointers and Logic - "flatten / nested iteration" Proposal

2021-07-21 Thread Sven Voigt
Hello Python-ideas, I am working with lots of JSON objects in my work and need to obtain JSON pointers to particular components of a JSON object. These pointers are defined as part of the JSON-LD specifications as relative IRIs and as part of the JSON-Schema specifications. However, I am not aware

[Python-ideas] Re: Nested Dictionary Pointers and Logic - "flatten / nested iteration" Proposal

2021-07-21 Thread Paul Moore
You've given some examples of what flatten() does, but I still don't really understand how it's expected to work. Could you provide a specification, rather than just examples? Also, I've never needed a function like this in anything I've ever done - that may mean nothing, but it does suggest that y

[Python-ideas] Re: Nested Dictionary Pointers and Logic - "flatten / nested iteration" Proposal

2021-07-21 Thread Sven Voigt
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 tu

[Python-ideas] Re: Nested Dictionary Pointers and Logic - "flatten / nested iteration" Proposal

2021-07-21 Thread Chris Angelico
On Thu, Jul 22, 2021 at 1:14 AM Sven Voigt 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

[Python-ideas] Re: Nested Dictionary Pointers and Logic - "flatten / nested iteration" Proposal

2021-07-21 Thread Sven Voigt
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 wrote: > On Thu, Jul 22, 2021 at 1:14 AM Sven Voi

[Python-ideas] Re: Nested Dictionary Pointers and Logic - "flatten / nested iteration" Proposal

2021-07-21 Thread Chris Angelico
On Thu, Jul 22, 2021 at 1:28 AM Sven Voigt 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. > JSON itself is standardized, heavily

[Python-ideas] Re: Nested Dictionary Pointers and Logic - "flatten / nested iteration" Proposal

2021-07-21 Thread Paul Moore
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 some

[Python-ideas] Re: Nested Dictionary Pointers and Logic - "flatten / nested iteration" Proposal

2021-07-21 Thread Oliver Margetts
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, wrote: > Maybe your examples aren't making it clear

[Python-ideas] Re: Nested Dictionary Pointers and Logic - "flatten / nested iteration" Proposal

2021-07-21 Thread Christopher Barker
I would add that this seems to me like something you need. So be all means write it, document it, maybe publish it on PyPi, and then, if it does seem to be generally useful, propose it for the stdlib. In fact, if something like this were to be included in the stdlib, we’d probably want a back-po

[Python-ideas] Re: Nested Dictionary Pointers and Logic - "flatten / nested iteration" Proposal

2021-07-21 Thread Sven Voigt
Thank you so much for all of your responses. I am not aware of the procedure for suggesting ideas but building a PyPI package with documentation and then sharing here seems like a good way to build this out (which I will get started on). Also, scalpl looks really cool, although I am not sure it doe

[Python-ideas] Re: Nested Dictionary Pointers and Logic - "flatten / nested iteration" Proposal

2021-07-21 Thread Chris Angelico
On Thu, Jul 22, 2021 at 5:22 AM Sven Voigt wrote: > > Thank you so much for all of your responses. I am not aware of the procedure > for suggesting ideas but building a PyPI package with documentation and then > sharing here seems like a good way to build this out (which I will get > started on

[Python-ideas] RFC for PEP 663: Improving and Standardizing Enum str(), repr(), and format() behaviors

2021-07-21 Thread Ethan Furman
PEP: 663 Title: Improving and Standardizing Enum str(), repr(), and format() behaviors Version: $Revision$ Last-Modified: $Date$ Author: Ethan Furman Discussions-To: [email protected] Status: Draft Type: Informational Content-Type: text/x-rst Created: 23-Feb-2013 Python-Version: 3.11 Post-His