I have to admit that the documentation 
(http://docs.sympy.org/modules/core.html?highlight=subs#sympy.core.basic.Basic.subs)
 misled me into thinking that subs() works directly on the variable itself, and 
there is no need to assign the output to another variable.
All expressions in SymPy are always immutable, so no operation will ever be 
done in place.  This should go in the gotchas, I think.
Thank you very much for your response! Yes, I agree with you, Aaron; I also think that it should go in the gotchas as well.

If I would have seen something similar to the following in the documentation, 
then I think I would have immediately realized that the output can be placed 
into a variable.

expr = (1+x*y).subs([(x,pi), (y,2)])
Can you submit a patch changing this?  I agree that it would be clearer.  Also, if you 
want to add a bit to the gotchas (http://docs.sympy.org/gotchas.html) noting that 
expressions are immutable, that would be great too (or if you don't have time to submit 
such a patch, can you at least create an issue for it?).  The docs are in the docs/src 
directory of the sympy repository, and you can test build them by typing "cd docs; 
make html" (requires Sphinx), and they will be build into _build.

Yes, I will submit a patch for this, and I will also attempt to make a few more suggestions/changes as well.


Nicholas




--
You received this message because you are subscribed to the Google Groups 
"sympy" 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?hl=en.

Reply via email to