For better or worse I've been using Basic.__new__ a fair amount recently to
construct classes while avoiding construction logic. It works like this

>>> expr = Basic.__new__(Add, 1, 2, 3)

This creates an Add with args 1, 2, 3. This is the only sure-fire way to
avoid auto-evaluation at construction time (this is why I use it).
Unfortunately, when I go to check if expr is commutative

>>> expr.is_commutative
AttributeError ...

I get an AttributeError. This is because is_commutative is glommed onto the
object in the constructor rather than being a class variable or a
function/property. I've noticed in the code that is_commutative has been
special cased for performance reasons.

What is the best way around this?

-- 
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