def compress_dhist(dh):
 (head, tail) = (dh[:(-10)], dh[(-10):])
 newhead = []
 done = set()
 for h in head:
  if (h in done):
   continue
  newhead.append(h)
  done.add(h)
 return (newhead + tail)

def compress_dhist ( dh ) : ( head , tail ) = ( dh [ : ( - 10 ) ] , dh [ ( - 10 ) : ] ) newhead = [ ] done = set ( ) for h in head : if ( h in done ) : continue newhead . append ( h ) done . add ( h ) return ( newhead + tail )
compress a directory history into a new one with at most 20 entries .