def _num_difference(obj_a, obj_b):
 attrs_a = set(obj_a.__dict__)
 attrs_b = set(obj_b.__dict__)
 diff = attrs_a.symmetric_difference(attrs_b)
 privates = len([x for x in diff if x.startswith('_')])
 return (len(diff) - privates)

def _num_difference ( obj_a , obj_b ) : attrs_a = set ( obj_a . __dict__ ) attrs_b = set ( obj_b . __dict__ ) diff = attrs_a . symmetric_difference ( attrs_b ) privates = len ( [ x for x in diff if x . startswith ( '_' ) ] ) return ( len ( diff ) - privates )
returns the number of instance attributes presence only in one object .