Created
October 31, 2019 17:02
-
-
Save fakedrake/a783cc95369eaaf92f9da3d18c5de211 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 clean_reversed_seq(seq): | |
skip = 0 | |
# Find a version of reversed that is an iterator | |
for i in reversed(seq): | |
if i == '\b': | |
skip += 1 | |
elif skip == 0: | |
yield i | |
else: | |
skip -= 1 | |
def compare_seqs(seq0,seq1): | |
return all((i == j | |
for i,j | |
in zip(clean_reversed_seq(seq0), clean_reversed_seq(seq1)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment