Python is great, I just wish it had JS-like object destructuring applied to dicts – so convenient!
a = {"foo": "bar", "bar": "foo"}
b = {**a}
You can do this since 3.5
https://www.python.org/dev/peps/pep-0448/You can also do dict comprehensions which is much more expressive
b = {k: v for k,v in a.items() if v == "bar"}
This way you can copy only the parts of a dict you want in a simple one-liner. from munch import Munch
foo = {'a':1, 'b':2}
foo = Munch(foo)
print(foo.a) # 1
print(foo['a']) # 1