On Mon, Jun 25, 2012 at 4:59 PM, Aaron Meurer <[email protected]> wrote:
>
> The most common interface for your class and .args do not have to be
> the same. .args just has to be one of the legal interfaces. Many
> classes store a .args that is different from what would usually be
> entered, for varying reasons.  I think the most common is a
> canonicalization that would be more annoying for a user to enter but
> is more convenient to parse, but I suppose an equally legitimate
> reason would be to avoid computing something again.

Indeed, I think I get your point.

> I hope I understood your question correctly. Otherwise, a specific
> example might help.

I'll give more details.  The class DiagramGrid lays out a Diagram in a
grid.  DiagramGrid internally creates a grid, in which it places the
objects of the supplied Diagram.  Thus, the sole purpose of existence
of DiagramGrid is to lay out a Diagram.

According to the reasoning you and Stefan have provided, I should also
allow the construction of a DiagramGrid from a Diagram *and* a grid,
into which the Diagram has already been laid out.  Is that so?

Or, perhaps, I am abusing Basic and Basic.args in general?

>>> Check that .subs, .atoms and .free_symbols work on expressions
>>> containing your classes (by expressions I do not necessary mean Expr
>>> subclasses). This reveals **a lot** of mistakes.
>>
>> Hm, that sounds like a nice test, in general, thank you.  However, I'm
>> not sure the class I am currently working on can be a part of an
>> expression.
>
> subs and atoms should work in any case. I think free_symbols might
> only make sense for Expr, though.

Hm, I see.  I'll look at this issue in sympy.categories shortly.
Thank you everyone for pointing this out.

Sergiu

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" 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?hl=en.

Reply via email to