code: def depth_first_sub(expr,values):
    "replace SubLit with literals in expr. (expr is mutated)."
    arr=treepath.sub_slots(expr,lambda elt:elt is sqparse2.SubLit)
    if len(arr)!=len(values): raise ValueError('len',len(arr),len(values))
    for path,val in zip(arr,values):
      # todo: does ArrayLit get us anything? tree traversal?
      if isinstance(val,(basestring,int,float,type(None),dict)): expr[path] = sqparse2.Literal(val)
      elif isinstance(val,(list,tuple)): expr[path] = sqparse2.ArrayLit(val)
      else: raise TypeError('unk_sub_type',type(val),val) # pragma: no cover
    return expf depth_first_sub(expr,values):
    "replace SubLit with literals in expr. (expr is mutated)."
    arr=treepath.sub_slots(expr,lambda elt:elt is sqparse2.SubLit)
    if len(arr)!=len(values): raise ValueError('len',len(arr),len(values))
    for path,val in zip(arr,values):
      # todo: does ArrayLit get us anything? tree traversal?
      if isinstance(val,(basestring,int,float,type(None),dict)): expr[path] = sqparse2.Literal(val)
      elif isinstance(val,(list,tuple)): expr[path] = sqparse2.ArrayLit(val)
      else: raise TypeError('unk_sub_type',type(val),val) # pragma: no cover
    return expr
docs: replace SubLit with literals in expr. (expr is mutated).