Skip to content

Instantly share code, notes, and snippets.

@joelburton
Created July 31, 2020 18:12

Revisions

  1. joelburton created this gist Jul 31, 2020.
    10 changes: 10 additions & 0 deletions pojo.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    class POJO(dict):
    def __getattr__(self, attr):
    return self[attr]

    def __setattr__(self, attr, val):
    try:
    super().__getattr__(self, attr)
    super().__setattr__(self, attr, val)
    except AttributeError:
    self[attr] = val