So, either everything should have Basic args, which means no None, tuples, etc., or we could have some kind of helper method in Basic that returns a list of only the symbolic arguments. For the second one, you would modify the list with what you want, and then send it back to the same object through some other method, and it puts everything back where it belongs (it doesn't have to be in place, though).
What do you think? Aaron Meurer On Mar 28, 2010, at 7:51 PM, smichr 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? > > -- > 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. > -- 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.