Skip to content

Instantly share code, notes, and snippets.

@kamikat
Last active December 17, 2015 12:09
Show Gist options
  • Save kamikat/5607662 to your computer and use it in GitHub Desktop.
Save kamikat/5607662 to your computer and use it in GitHub Desktop.
python 2.7 implementation of AttributeDict
class AttributeDict(dict):
__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
a = AttributeDict()
a['item'] = 1
assert a.item == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment