def allequal(seq):
 if (len(seq) < 2):
  return True
 val = seq[0]
 for i in xrange(1, len(seq)):
  thisval = seq[i]
  if (thisval != val):
   return False
 return True

def allequal ( seq ) : if ( len ( seq ) < 2 ) : return True val = seq [ 0 ] for i in xrange ( 1 , len ( seq ) ) : thisval = seq [ i ] if ( thisval != val ) : return False return True
return *true* if all elements of *seq* compare equal .