Either use Symbol (directly or by subclassing) or look at how Symbol does it. I think the key for Symbol is that it subclasses from Atom, so it has an empty .args. Also, it overrides _hashable_content so that it hashes correctly.
Aaron Meurer On Jun 10, 2012, at 1:22 PM, Sergiu Ivanov <[email protected]> wrote: > Hello, > > I have a class Object, which has one meaningful attribute: a string > name. If I store the string name directly in Basic.args, Object will > not pass _test_args, because the only element of the tuple Basic.args > is a string, and is not an instance of Basic. Some other classes > (like IndexedBase) store an instance of Symbol with the proper name in > Basic.args. > > What would be my best bet? Store a Symbol in Basic.args instead of a > string? Or is there a different canonical way to approach this > problem? > > 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. > -- 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.
