{"library":"python-autoviv","title":"python-autoviv: Autovivification for Python Dictionaries","description":"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.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install python-autoviv"],"cli":null},"imports":["from autoviv import AutoVivification"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from autoviv import AutoVivification\n\nd = AutoVivification()\nd[1]['one'][2]['two'] = \"Nested is as nested does.\"\nd[1]['one'][2]['three'] = \"Or so they say.\"\n\nprint(d)\n# Expected output: {1: {'one': {2: {'two': 'Nested is as nested does.', 'three': 'Or so they say.'}}}}\n\n# Accessing a non-existent path creates it\nif 'new_key' not in d[1]['one']:\n    print(\"'new_key' does not exist in d[1]['one'] initially.\")\n\nd[1]['one']['new_key']['sub_key'] = 42\nprint(f\"Value at d[1]['one']['new_key']['sub_key']: {d[1]['one']['new_key']['sub_key']}\")\n# Expected output: Value at d[1]['one']['new_key']['sub_key']: 42","lang":"python","description":"Initialize an `AutoVivification` object and create nested dictionary structures by simply assigning values to deeply nested keys. Intermediate dictionaries are automatically created.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}