python-autoviv provides autovivification for Python dictionaries, allowing the creation of deeply nested data structures on-the-fly simply by accessing keys. It mimics Perl's default behavior, eliminating the need for explicit intermediate dictionary initializations. The current version is 1.0.4, with releases focusing on stability and minor enhancements.
pip install python-autovivVerified import paths — ran on the pinned version, not inferred.
Initialize an `AutoVivification` object and create nested dictionary structures by simply assigning values to deeply nested keys. Intermediate dictionaries are automatically created.
Always double-check key names, especially when assigning. Consider using `dict.get()` with a default value or `if 'key' in d:` checks if you need to strictly verify key existence before modification.
Be mindful of performance for extremely large or sparse datasets. If memory is a critical concern, consider alternative strategies or ensure all vivified paths are eventually populated with meaningful data.
To recursively convert the entire structure to standard Python dictionaries, you'll need a helper function that iterates through the `AutoVivification` instance and converts all nested instances as well.
No dependency data recorded yet.