Skip to content

Instantly share code, notes, and snippets.

@heewa
heewa / diff_data.py
Created March 5, 2013 17:52
For when you're comparing two large, deeply hierarchical things that are very slightly different.
def diff_data(d1, d2, d1_name='d1', d2_name='d2'):
"""Return fields in one but not the other, or None if they're the same.
"""
if d1 == d2:
return None
elif type(d1) != type(d2):
return {d1_name: d1, d2_name: d2}
elif isinstance(d1, dict):
diff = {}
for key, v1 in d1.iteritems():
@starenka
starenka / .gitignore
Created September 18, 2011 20:02
fabfile to deploy flask app to nginx/supervisor/uwsgi stack
.idea/*
*.pyc