Maybe you could look at how Indexed does it, in sympy/tensors/indexed.py, as it is (unfortunately, see http://code.google.com/p/sympy/issues/detail?id=2659) always non-commutative. Hopefully the way that it does it is correct and I'm not just misleading you (but it does work anyway).
Aaron Meurer On Fri, Mar 9, 2012 at 3:13 PM, Alan Bromborsky <abro...@verizon.net> wrote: > I have a class Vector where: > > class Vector(Symbol): > > def __init__(self,basis_str=None): > if isinstance(basis_str,Vector): > self = basis_str > else: > if basis_str == None or basis_str == '0': > self = S(0) > else: > Symbol.__init__(self,basis_str,commutative=False) > print self > print self.is_commutative > > then: > > er = Vector('er') > > outputs my diagnostic print - > > er > True > > How do I subclass and get self.is_commutative = False? > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to sympy@googlegroups.com. > To unsubscribe from this group, send email to > sympy+unsubscr...@googlegroups.com. > 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 sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.