Skip to content

Instantly share code, notes, and snippets.

@curzona
Created May 24, 2015 20:40
Show Gist options
  • Select an option

  • Save curzona/17a7e4287ec04226f3ed to your computer and use it in GitHub Desktop.

Select an option

Save curzona/17a7e4287ec04226f3ed to your computer and use it in GitHub Desktop.
Add operator for Dictionaries
from pprint import pprint
a = _Dict({'a':'1'})
b = _Dict({'b':'2'})
pprint(a + b)
class _Dict(dict):
def __add__(a, b):
n = dict()
n.update(a)
n.update(b)
return n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment