For my first post: a small trick I’ve recently discovered.

Suppose you have a dict that you want to copy while changing the values of some keys. A single instruction can do it:

new = dict(old, a=1, b=2, c=3)

This is equivalent to:

new = old.copy()
new.update({"a": 1, "b": 2, "c": 3})

Of course it will works only for keys that are valid Python identifiers, but I find it useful quite often.