On Thu, Jul 22, 2021 at 5:22 AM Sven Voigt <svenpvoigt@gmail.com> 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). Also, scalpl looks really cool, although I am not sure it does any mapping or support non-standard data types (will check it out more).
Also, if this wasn't clear before, my interpretation of the JSON library's dump function was that it was a very specific implementation of an otherwise generic nested iteration technique for mapping nested data structures from a domain to the JSON domain, where the mapping may not be invertible. Once generically implemented, JSON dumps would use the nested iteration functionality to map any nested data structure onto the JSON domain, the string representation of the resulting structure would be a valid JSON string. So, this should be a generalization of an existing method to map any nested data structure between different domains, where the mapping could be altering dictionary keys, the type of a value or object, or traversing other nested data types.
Beware of the trap of overgeneralization. https://thedailywtf.com/articles/The_Inner-Platform_Effect If you try to make a generic way to map any data structure to any other, you'll end up with a function so utterly generic that the means of telling it what to do... is basically just the same code that would do the mapping manually. At best, what you'll be doing is reinventing generic tools like map(). Sometimes, it's best to just write the code you need, when you need it, instead of trying to make something for every possible use-case. ChrisA