Skip to content

[Feature] Support dot-access on WireDict for parity with WireNamespace #22

@reecelikesramen

Description

@reecelikesramen

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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions