Last active
December 17, 2015 12:09
-
-
Save kamikat/5607662 to your computer and use it in GitHub Desktop.
python 2.7 implementation of AttributeDict
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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