2013/5/21 Aaron Meurer <asmeu...@gmail.com>

> Thanks for responding. I think most of what I want to say is in
> response to Matthew, but let me just mention that I agree with Ronan.
> Integer is very different from int. Aside from the obvious difference
> with division, every attribute and method of the classes it inherits
> from are avaialble on it, giving it a standard interface. This is
> fundamental to this discussion. Basic subclasses are Liskov
> substitutable.  I can write expr.args or expr.atoms or expr.xreplace
> without worrying if expr is an Add or a Symbol or an Integer.
> Division is a special case of this. This simply is not true for
> strings and ints.
>
> By the way, Ronan, which option do you prefer? Or is there another
> even better option that only you can see?
>

Going back to the basics of the structure of expression trees, I think that
we are conflating things that should be considered separate. The elements
of .args are child nodes, but .name attributes and the like do not behave
at all like nodes of the expression tree. We should consider the latter as
attributes of the head node so that the structure of MatrixSymbol('A', m,
n) conceptually looks like:

* MatrixSymbolHead('A')
|
+- Symbol('m')
+- Symbol('n')

However, I'm not sure that this MatrixSymbolHead('A') should actually exist
as a Python object. If it does, then MatrixSymbol('A', m, n).func should be
equal to it. Otherwise, the fundamental invariant should rather be written
as 'obj == obj.rebuild(*obj.args)', and the MatrixSymbolHead thing would
only exist implicitly in the implementation of MatrixSymbol.rebuild().

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to