Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Is it broken or a feature? cannot update keys any more if key is a dict for AttrDict #35

Open
hihellobolke opened this issue May 12, 2015 · 3 comments

Comments

@hihellobolke
Copy link

>>> attr = AttrDict({'foo': {"bar": "molotov"}})
>>> attr.foo
AttrDict({'bar': 'molotov'})
>>> attr.foo.bar = 'update molotov'
>>> attr
AttrDict({'foo': {'bar': 'molotov'}})
>>>
@hihellobolke
Copy link
Author

But AttrDefault works as expected

>> attr = AttrDefault(dict, {'foo': {"bar": "molotov"}})
>>> attr.foo
AttrDefault(<type 'dict'>, False, {'bar': 'molotov'})
>>> attr.foo.bar = 'update molotov'
>>> attr
AttrDefault(<type 'dict'>, False, {'foo': {'bar': 'update molotov'}})

@louking
Copy link

louking commented Feb 11, 2016

This seems like a deal breaker -- is this repo still under active development?

@jhermann
Copy link

from attrdict import AttrDict

d = AttrDict()
d.foo = {}

d.foo['bar'] = 42
print(d)
d['foo']['bar'] = 42
print(d)

gives you

AttrDict({'foo': {}})
AttrDict({'foo': {'bar': 42}})

Ridiculous.

Time to fully switch to addict.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants