def uniq(dupes, attrs):
 key = (lambda d: '/'.join([(getattr(d, a) or '') for a in attrs]))
 keys = []
 deduped = []
 for d in dupes:
  if (key(d) not in keys):
   deduped.append(d)
   keys.append(key(d))
 return deduped

def uniq ( dupes , attrs ) : key = ( lambda d : '/' . join ( [ ( getattr ( d , a ) or '' ) for a in attrs ] ) ) keys = [ ] deduped = [ ] for d in dupes : if ( key ( d ) not in keys ) : deduped . append ( d ) keys . append ( key ( d ) ) return deduped
exclude elements of dupes with a duplicated set of attribute values .