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

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