Multiple access patterns for key-value reference. attmap provides AttMap, a mapping subclass that allows attribute-style access (e.g., obj.key) alongside dict-style access (e.g., obj['key'] or obj.get('key')). It is useful for configuration objects, simple namespaces, and data structures where you want flexible key access. Version 0.14.0 is stable, requires Python >=3.8, and is maintained on GitHub (pepkit/attmap).
pip install attmapVerified import paths — ran on the pinned version, not inferred.
Create an AttMap and use both attribute and dict-style access.
Use identical case for attribute access as the dict key.
Avoid keys that are not valid identifiers if you need attribute access, or use obj['key'].
Access such keys via dict-style subscript: obj['keys'].
Use 'AttMap' instead of any deprecated aliases.
Check that the key exists and is a valid Python identifier; if not, use obj['key'] instead.
Use .get('key', default) to avoid the error, or ensure the key exists before access.Check if you are using a read-only variant; use the standard AttMap for mutable operations.