~berdario/+junk/palyndromes

« back to all changes in this revision

Viewing changes to palyndromes.py

  • Committer: Dario Bertini
  • Date: 2011-09-13 20:32:52 UTC
  • Revision ID: berdario@gmail.com-20110913203252-q7eegnv4bgkv53jm
Removed timing code (this way its output can be easily piped somewhere else)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import random
2
 
from time import time
3
2
from trie import Trie
4
3
 
5
4
class PalyndromeFinder(object):
41
40
        dictfile = "italian.txt"
42
41
        finder = PalyndromeFinder(dictfile)
43
42
        
44
 
        count = 0
45
 
        t2 = time()
46
43
        while True:
47
44
                result = finder.find()
48
45
                if result:
49
 
                        print result
50
 
                        count += 1
51
 
                        if count % 10000 == 0:
52
 
                                t, t2 = t2, time()
53
 
                                print "10000 palyndromes in %s s" % (t2-t,)
 
 
b'\\ No newline at end of file'
 
46
                        print result
 
 
b'\\ No newline at end of file'