On Oct 6, 2010, at 6:17 AM, Vinzent Steinberg wrote: > On 6 Okt., 08:55, smichr <smi...@gmail.com> wrote: >> Add wants items, not a generator: >> >> return Add(*[term for term in expr.as_Add() if >> term.as_coeff_terms()[0] >= tol]) >> >> To summarize: >> >> use Add(a,b,c) or Add(*[a,b,c]) or Add(*[x for x in iter]) but not >> Add(x for x in iter) > > I think this should be fixed for the sake of a cleaner syntax, even if > Add(*[...]) was still faster. Expr() should accept generators. > > Vinzent
Is there any reason why Add couldn't be just as fast for an iterator, i.e., suck out all the terms before flattening them? I agree that it should work either way, though. Actually, I don't see why Add([…]) doesn't work either. Aaron Meurer -- 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.