As an example:
class Unevaluated(Expr):
def __new__(cls, wrapped_type, *args, **kwargs):
obj = Expr.__new__(cls, *args, **kwargs)
obj._wrapped_type = wrapped_type
kwargs["evaluate"] = False
obj._wrapped_object = wrapped_type(*args, **kwargs)
return obj
def func(self, *args, **kwargs):
return Unevaluated(self._wrapped_type, *args, **kwargs)
def __getattr__(self, name):
return getattr(self._wrapped_type, name)
def __str__(self):
return self._wrapped_object.__str__()
def __repr__(self):
return self._wrapped_object.__repr__()
def evaluate(self):
return self._wrapped_object.func(*self._wrapped_object.args)
So you would call *Unevaluated(Pow, 2, 3)* to represent *2**3* in the
unevaluated form.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/00f00329-a754-40dd-a4d3-d8e3be3a156a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.