mydict.py 326 B

1234567891011121314
  1. class Dict(dict):
  2. def __init__(self, **kw):
  3. super().__init__(**kw)
  4. def __getattr__(self, key):
  5. try:
  6. return self[key]
  7. except KeyError:
  8. raise AttributeError(r"'Dict' object has no attribute '%s'" % key)
  9. def __setattr__(self, key, value):
  10. self[key] = value