On Sun, Mar 28, 2010 at 6:51 PM, smichr <smi...@gmail.com> wrote:
> 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?

I agree that we should make this easier. You can also look at
postorder_traversal and similar methods in
sympy/utilities/iterables.py.

Do you have some ideas how it could be made simpler (for example by
improving integrals and Atoms)?

Ondrej

-- 
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