Adapt Polynom with Expression.tmp_render env
This commit is contained in:
parent
48c2c1dc78
commit
8881a15c9b
@ -291,19 +291,15 @@ class Polynom(object):
|
||||
# On converti en Expression
|
||||
coef_exp = Expression(postfix_add)
|
||||
|
||||
old_render = Expression.get_render()
|
||||
Expression.set_render(lambda _,x:Expression(x))
|
||||
with Expression.tmp_render():
|
||||
coef_steps = list(coef_exp.simplify())
|
||||
Expression.set_render(old_render)
|
||||
|
||||
#print('\t 1.coef_steps -> ', coef_steps)
|
||||
|
||||
elif type(coef) == Expression:
|
||||
|
||||
old_render = Expression.get_render()
|
||||
Expression.set_render(lambda _,x:Expression(x))
|
||||
with Expression.tmp_render():
|
||||
coef_steps = list(coef.simplify())
|
||||
Expression.set_render(old_render)
|
||||
|
||||
#print('\t 2.coef_steps -> ', coef_steps)
|
||||
|
||||
@ -524,7 +520,7 @@ def test(p,q):
|
||||
|
||||
if __name__ == '__main__':
|
||||
#from .fraction import Fraction
|
||||
Expression.set_render(txt)
|
||||
with Expression.tmp_render(txt):
|
||||
p = Polynom([10, -5])
|
||||
q = Polynom([3, -9])
|
||||
print(p-q)
|
||||
|
Loading…
Reference in New Issue
Block a user