Updates:
Labels: -EasyToFix
Comment #4 on issue 1206 by [email protected]: Integer and Rational do
not implement .args
http://code.google.com/p/sympy/issues/detail?id=1206
This is a problem with all Atoms. There are two kinds of object in sympy,
composite objects and atoms.
Composite objects are made of other sympy objects that can be accessed
with .args. Their state is completely determined by their class and their
args.
For expression manipulation, subclasses of Atom form the boundary between
sympy and the external world. Their state is determined by ordinary Python
attributes that aren't part of the API of Basic/Expr so that anything
inside them is hidden from sympy. Therefore, the only correct value
for .args is the empty tuple.
Now, concerning the expr.func(*expr.args) invariant, there are only 2
possibilities:
* Make atom.func return atom, and atom() return atom. Concretely, we'd have:
>>> Integer(42)
42
>>> Integer(42).args
()
>>> Integer(42)()
42
* Consider that the invariant doesn't apply to Atoms. In that case, they
shouldn't have .func and probably not .args either.
--
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.