def _dict_diff(a, b):
 if (set(a.keys()) - set(b.keys())):
  LOG.debug('metadata diff -- master has extra keys: %(keys)s', {'keys': ' '.join((set(a.keys()) - set(b.keys())))})
  return True
 for key in a:
  if (str(a[key]) != str(b[key])):
   LOG.debug('metadata diff -- value differs for key %(key)s: master "%(master_value)s" vs slave "%(slave_value)s"', {'key': key, 'master_value': a[key], 'slave_value': b[key]})
   return True
 return False

def _dict_diff ( a , b ) : if ( set ( a . keys ( ) ) - set ( b . keys ( ) ) ) : LOG . debug ( 'metadata diff -- master has extra keys: %(keys)s' , { 'keys' : ' ' . join ( ( set ( a . keys ( ) ) - set ( b . keys ( ) ) ) ) } ) return True for key in a : if ( str ( a [ key ] ) != str ( b [ key ] ) ) : LOG . debug ( 'metadata diff -- value differs for key %(key)s: master "%(master_value)s" vs slave "%(slave_value)s"' , { 'key' : key , 'master_value' : a [ key ] , 'slave_value' : b [ key ] } ) return True return False
a one way dictionary diff .