Re:Stop passing naked dictionaries around: Introducing DStru...
by io41 on Thursday November 24, 2011 @08:02AM
(#3274176)
I agree.
Though a more useful constructor would be nice for naked dicts. I've created a helper function that allows for nicer construction of dicts based on other dicts and potential new fields:
https://gist.github.com/24651d78d3f1e3dec6f4 :
def new_dict(args, *kwargs):
d = new_dict(old_dict1, old_dict2, old_dictN, foo='bar')