Updates:
Cc: Vinzent.Steinberg asmeurer ondrej.certik Ronan.Lamy mattpap
Comment #3 on issue 2114 by smichr: Mul.make_args(S.One) returns ()
http://code.google.com/p/sympy/issues/detail?id=2114
My initially thoughts after encountering the new behavior of make_args is
that I would like to see the original behavior of make_args (as used to be
present in make_list and as_Add or as_Mul) be returned so that you always
have args to work with rather than a null tuple when the expression is the
class identity, e.g. Add.make_args(0) -> (0,) rather than () and
Mul.make_args(1) -> (1,). Without this, another test has to be put in place
whenever you want to process the args, e.g.
margs = list(Mul.make_args(x))
if margs[0].is_Rational:
do foo
becomes
if not margs or margs[0].is_Rational:
do foo
otherwise you will be accessing an item that is not there and this would
raise an error. Perhaps in such cases, though, one should be using
as_coeff_terms/factors instead.
In addition, Rational.args is () so one might reasonably expect that
make_args should return the null set. However, Add.make_args(Rational(1,
2)) is (1/2, ) while Add.make_args(0) is () and this seems odd.
The question that should be decided is whether the coder should have to
think about whether there is an arg or not after making a request that an
expressions arguments be returned as an Add or a Mul's arguments or whether
this should be handled by make_args.
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.