-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create converter for nested dictionaries / objects #9
Comments
Labelled as "wontfix" after Version 1.8.0 simply because the main authors don't currently have the time for non essential enhancements. If there's a huge uptake in people using CleverDict and asking for this feature that may change, or if you're reading this why not Fork, develop a solution, and contribute a Pull Request yourself? |
Revisiting this after some time and while writing tests for my new Whatsapp class... I think the solution may be to set an option and if True, every time a new value is set, check to see if its value (or recursively, any of the values contained therein) is a Dictionary; if it is a dictionary, convert it to a cleverdict. |
Create a new utility method (or enhance init?) to convert nested dictionaries into nested CleverDicts, so that deeper levels can be accesses easily with "." notation. For example:
I'd also like to extend this functionality to attributes, which might be trickier. For example:
And the absolute ideal would be to handle any mixture of dictionaries and objects/attributes. For example:
The text was updated successfully, but these errors were encountered: