def collect_list(option, opt_str, value, parser):
 assert (value is None)
 value = []
 for arg in parser.rargs:
  if (arg[:1] == '-'):
   break
  value.append(arg)
 del parser.rargs[:len(value)]
 setattr(parser.values, option.dest, value)

def collect_list ( option , opt_str , value , parser ) : assert ( value is None ) value = [ ] for arg in parser . rargs : if ( arg [ : 1 ] == '-' ) : break value . append ( arg ) del parser . rargs [ : len ( value ) ] setattr ( parser . values , option . dest , value )
collect multiple option values into a single list .