def expand_pattern(string):
 (lead, pattern, remnant) = re.split(EXPANSION_PATTERN, string, maxsplit=1)
 (x, y) = pattern.split('-')
 for i in range(int(x), (int(y) + 1)):
  if remnant:
   for string in expand_pattern(remnant):
    (yield '{0}{1}{2}'.format(lead, i, string))
  else:
   (yield '{0}{1}'.format(lead, i))

def expand_pattern ( string ) : ( lead , pattern , remnant ) = re . split ( EXPANSION_PATTERN , string , maxsplit = 1 ) ( x , y ) = pattern . split ( '-' ) for i in range ( int ( x ) , ( int ( y ) + 1 ) ) : if remnant : for string in expand_pattern ( remnant ) : ( yield '{0}{1}{2}' . format ( lead , i , string ) ) else : ( yield '{0}{1}' . format ( lead , i ) )
expand a numeric pattern into a list of strings .