def srange(s, split=string.split, integer=_integerRE, integerRange=_integerRangeRE):
 l = []
 append = l.append
 for entry in split(s, ','):
  m = integer.match(entry)
  if m:
   append(int(m.groups()[0]))
   continue
  m = integerRange.match(entry)
  if m:
   (start, end) = map(int, m.groups())
   l[len(l):] = range(start, (end + 1))
 return l

def srange ( s , split = string . split , integer = _integerRE , integerRange = _integerRangeRE ) : l = [ ] append = l . append for entry in split ( s , ',' ) : m = integer . match ( entry ) if m : append ( int ( m . groups ( ) [ 0 ] ) ) continue m = integerRange . match ( entry ) if m : ( start , end ) = map ( int , m . groups ( ) ) l [ len ( l ) : ] = range ( start , ( end + 1 ) ) return l
converts a textual representation of integer numbers and ranges to a python list .