addicted = addict ExtendeD
This library comes from ‘mewwts/addict‘ with some more features.
Same as Dict from ‘mewwts/addict‘ except that update() method accept list,tuple and kwargs like usual python dict. The use of ‘inspect‘ module has been removed for performance reason.
Dict with these additional methods :
pprint() find(pattern,**kwargs) count_some_values(pattern,ignore_case=False) count_some_keys(pattern,ignore_case=False) count_some_items(filter) iter_some_items(pattern,ignore_case=False) iter_some_values(pattern,ignore_case=False) iter_some_keys(pattern,ignore_case=False) get_some_items(pattern,ignore_case=False) get_some_values(pattern,ignore_case=False) get_some_keys(pattern,ignore_case=False) mget(*key_list) extract(key_list) parse_booleans(key_list) parse_numbers(key_list) update_dict(*args, **kwargs)
Works like AddDict, except that it returns a ‘NoAttr‘ value when an attribute is missing. Please read noattr package notes for explaination about ‘NoAttr‘
from addicted import Dict,NoAttrDict d1 = AddDict() d2 = NoAttrDict() print type(d1.a.b.c.d) >>> <class 'addicted.AddDict'> print type(d2.a.b.c.d) >>> <class 'noattr.NoAttrType'>