python-attributedict icon indicating copy to clipboard operation
python-attributedict copied to clipboard

Bug with `x.y` style dictionary keys

Open gamesbook opened this issue 6 years ago • 1 comments

Error trace:

>>> data = AttributeDict({'foo': {'bar': [1, 2, 3]}, 'this.test': 1})
>>> data['this.test']
1
>>> data.this.test
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gamesbook/.venvs/attr/local/lib/python2.7/site-packages/attributedict/collections.py", line 226, in __getattr__
    raise AttributeError(error)
AttributeError: 'this'

gamesbook avatar Feb 15 '19 07:02 gamesbook

@gamesbook Thanks for adding this feature request. The library don't have official support for "flat keys" but was listed as a potential feature addition eventually: https://github.com/grimen/python-attributedict/issues/1

I am not sure if I will add support for it or not, as I don't have much usage for it at this time.

grimen avatar May 24 '19 03:05 grimen