I keep running into the following need and wonder if we should do
something about it.

Whenever I want to run a method over the arguments of an expression
(essential doing a deep processing of an expression) I have to set up
the following filter:

  if expr is None: # because integrals use None as a marker
      return None
  elif type(expr) in (list, set, tuple): # because integrals use
tuples
      return type(expr)([foo(a) for a in expr])
  return expr.func(*[foo(a) for a in expr.args or expr]) # "or expr"
since Atoms don't have args

Does anyone suggest a better approach or solution to the problem? or
see any problems with the above?

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to