def equal_attributes(obj1, obj2, attributes):
 if (not attributes):
  return False
 for attr in attributes:
  if callable(attr):
   if (not (attr(obj1) == attr(obj2))):
    return False
  else:
   if (not hasattr(obj1, attr)):
    return False
   if (not hasattr(obj2, attr)):
    return False
   if (not (getattr(obj1, attr) == getattr(obj2, attr))):
    return False
 return True

def equal_attributes ( obj1 , obj2 , attributes ) : if ( not attributes ) : return False for attr in attributes : if callable ( attr ) : if ( not ( attr ( obj1 ) == attr ( obj2 ) ) ) : return False else : if ( not hasattr ( obj1 , attr ) ) : return False if ( not hasattr ( obj2 , attr ) ) : return False if ( not ( getattr ( obj1 , attr ) == getattr ( obj2 , attr ) ) ) : return False return True
compare two objects attributes .