示例#1
0
 def _has_double_couples(s):
     couples = util.slide(2, s)
     couple_groups = [
         list(value)
         for key, value
         in itertools.groupby(
                 sorted(
                         enumerate(couples),
                         key=lambda (_, letters): letters
                 ),
                 key=lambda (_, letters): letters
         )
         ]
示例#2
0
 def _has_double_letters_with_middle(s):
     return any([True for a, _, c in  util.slide(3, s) if a == c])
示例#3
0
 def _has_double_letters(s):
     return any((True for a, b in util.slide(2, s) if a == b))