Description
Currently, WireDict only supports bracket access (e.g., user['id']). For better developer experience and consistency with WireNamespace (and more natural use in templates), WireDict should also support dot-access (e.g., user.id).
Proposed Solution
Implement __getattr__ and __setattr__ in WireDict in src/pywire/core/wire.py. This would allow WireDict to behave like a namespace while still maintaining its identity as a dictionary.
Benefits
- Consistency with
WireNamespace.
- cleaner access in templates (auto-unwrapping works more naturally with dot access).
- simplified transition between
wire({...}) (dict) and wire(...) (kwargs/namespace).
Description
Currently,
WireDictonly supports bracket access (e.g.,user['id']). For better developer experience and consistency withWireNamespace(and more natural use in templates),WireDictshould also support dot-access (e.g.,user.id).Proposed Solution
Implement
__getattr__and__setattr__inWireDictinsrc/pywire/core/wire.py. This would allowWireDictto behave like a namespace while still maintaining its identity as a dictionary.Benefits
WireNamespace.wire({...})(dict) andwire(...)(kwargs/namespace).