seed = str(hash("seed")) L = [seed] thing = seed while True: thing = str(hash(thing)) #print thing if thing in L: break L.append(thing)