def split_qexpr_parts(e):
 expr_part = []
 qexpr_part = []
 for arg in e.args:
  if (not isinstance(arg, QExpr)):
   expr_part.append(arg)
  else:
   qexpr_part.append(arg)
 return (expr_part, qexpr_part)

def split_qexpr_parts ( e ) : expr_part = [ ] qexpr_part = [ ] for arg in e . args : if ( not isinstance ( arg , QExpr ) ) : expr_part . append ( arg ) else : qexpr_part . append ( arg ) return ( expr_part , qexpr_part )
split an expression into expr and noncommutative qexpr parts .