-
-
Save dereknheiley/6721122 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isPalindrome(input_string): | |
def _string_iterator(): | |
_len = len(input_string) | |
for i in xrange(_len / 2): | |
yield input_string[i], input_string[_len - i - 1] | |
for c1, c2 in _string_iterator(): | |
if c1 != c2: | |
return False | |
return True | |
f = open('terabyteFile.txt') | |
#http://stackoverflow.com/questions/519633/lazy-method-for-reading-big-file-in-python | |
def read1k(): | |
return f.read(1024) | |
print 'testing to see if all the words are palindromes' | |
for stream in iter(read1k, ''): | |
if not isPalindrome(stream) : | |
raise SystemExit('#failwhale: false') | |
print 'Yo dawg, I hear you like palindromes: true' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
noon toon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment