Dave Benjamin wrote:
[EMAIL PROTECTED] wrote:
Now suppose I set expression2 = Sum([a,-a]) and Sum.simplify()
recognises that the two terms cancel and the Sum has value 0.
Can I make expression2.simplify() transform expression2 from an
instance of Sum to an instance of Number(0) **in
[EMAIL PROTECTED] wrote:
Dave Benjamin wrote:
I think it's much better for simplify() to return a new object
and leave the original object unmodified. You can still write:
expression2 = expression2.simplify()
A belated thank-you message for your reply to my posting. I took your
advice, and
Hello comp.lang.py,
Can you help me with ideas for the following (somewhat newbie) OO
design question in Python? Note, I'm using psuedo-code, not actual
Python for the examples!
Background:
---
I need to represent a small variety of mathematical constructs
symbolically using Python
[EMAIL PROTECTED] wrote:
Now suppose I set expression2 = Sum([a,-a]) and Sum.simplify()
recognises that the two terms cancel and the Sum has value 0.
Can I make expression2.simplify() transform expression2 from an
instance of Sum to an instance of Number(0) **in place**? Is that
possibe, or