{"id":2795,"library":"super-collections","title":"Super Collections","description":"Super Collections is a Python library (current version 0.6.2) that provides enhanced data structures, `SuperList` and `SuperDict`, which are designed for deeply nested data, similar to JSON or YAML structures. It offers features like recursive conversion of Python data structures, convenient dot-based access to nested elements, and a `super_collect()` factory function for easy instantiation. The library aims to simplify working with complex, nested collections and is actively maintained.","status":"active","version":"0.6.2","language":"en","source_language":"en","source_url":"https://github.com/fralau/super-collections","tags":["collections","data structures","nested","dict","list","json","yaml"],"install":[{"cmd":"pip install super-collections","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Requires Python 3.8 or newer.","package":"python","optional":false},{"reason":"Required for Hjson parsing capabilities.","package":"hjson","optional":false}],"imports":[{"note":"Use the factory function to create SuperList or SuperDict instances from existing data.","symbol":"super_collect","correct":"from super_collections import super_collect"},{"note":"Represents an enhanced list supporting nested SuperCollections and dot access.","symbol":"SuperList","correct":"from super_collections import SuperList"},{"note":"Represents an enhanced dictionary supporting nested SuperCollections and dot access.","symbol":"SuperDict","correct":"from super_collections import SuperDict"},{"note":"SuperCollection is an abstract base class; it cannot be directly instantiated. SuperList and SuperDict are concrete implementations.","wrong":"from super_collections import SuperCollection; instance = SuperCollection()","symbol":"SuperCollection","correct":"from super_collections import SuperCollection"}],"quickstart":{"code":"from super_collections import super_collect, SuperList, SuperDict\n\n# Create a SuperDict from a regular Python dictionary\ndata = {'user': {'name': 'Alice', 'details': {'age': 30, 'city': 'NY'}} }\nsd = super_collect(data)\n\n# Access nested elements using dot notation\nprint(f\"User name: {sd.user.name}\")\nprint(f\"User city: {sd.user.details.city}\")\n\n# Create a SuperList from a regular Python list\nitems = [1, {'product': 'Laptop', 'price': 1200}, 3]\nsl = super_collect(items)\n\n# Access elements in a SuperList\nprint(f\"First item: {sl[0]}\")\nprint(f\"Product name: {sl[1].product}\")\n\n# Modify elements\nsd.user.details.age = 31\nprint(f\"Updated age: {sd.user.details.age}\")","lang":"python","description":"This quickstart demonstrates how to create `SuperDict` and `SuperList` instances using the `super_collect` factory function and access nested data using convenient dot notation."},"warnings":[{"fix":"Always use `SuperList()`, `SuperDict()`, or the `super_collect()` factory function to create collection instances.","message":"The `SuperCollection` class is an abstract base class and cannot be instantiated directly. `SuperList` and `SuperDict` are the concrete, instantiable collection types that are instances of `SuperCollection`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware that inputs passed to `super_collect()` will be deeply converted. If specific nested types must be preserved, consider manual construction or shallow copying where appropriate.","message":"The `super_collect()` factory function performs recursive conversion of Python lists and dictionaries into `SuperList` and `SuperDict` instances. This might implicitly change the type of nested standard Python collections, which could be unexpected if strict preservation of original container types (e.g., `list` instead of `SuperList`) is critical for certain custom objects or behaviors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use `try-except AttributeError` for gracefully handling missing keys when using dot notation, or check for key existence (e.g., `if 'key' in my_superdict:`) before access.","message":"When using dot notation (e.g., `my_superdict.non_existent_key`) for accessing elements, attempting to access a non-existent key will raise an `AttributeError`, not a `KeyError` as with standard Python dictionaries. This distinction is important for error handling.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}