def update_default_args(defaults, updates):
 arg_name = re.compile('^-?-?\\s*=?([^\\s=]+)')
 defined_defaults_ = map((lambda arg: (arg_name.search(arg).group(1), arg)), defaults)
 defined_defaults = OrderedDict()
 for elm in defined_defaults_:
  defined_defaults[elm[0]] = elm[1]
 defined_updates_ = map((lambda arg: (arg_name.search(arg).group(1), arg)), updates)
 defined_updates = OrderedDict()
 for elm in defined_updates_:
  defined_updates[elm[0]] = elm[1]
 defined_defaults.update(defined_updates)
 return defined_defaults.values()

def update_default_args ( defaults , updates ) : arg_name = re . compile ( '^-?-?\\s*=?([^\\s=]+)' ) defined_defaults_ = map ( ( lambda arg : ( arg_name . search ( arg ) . group ( 1 ) , arg ) ) , defaults ) defined_defaults = OrderedDict ( ) for elm in defined_defaults_ : defined_defaults [ elm [ 0 ] ] = elm [ 1 ] defined_updates_ = map ( ( lambda arg : ( arg_name . search ( arg ) . group ( 1 ) , arg ) ) , updates ) defined_updates = OrderedDict ( ) for elm in defined_updates_ : defined_updates [ elm [ 0 ] ] = elm [ 1 ] defined_defaults . update ( defined_updates ) return defined_defaults . values ( )
takes a list of default arguments and overwrites the defaults with contents of updates .