Status: Accepted
Owner: smichr
CC: jensen.oyvind
Labels: Type-Defect Priority-Medium

New issue 1920 by smichr: SymTuple doesn't rebuild itself
http://code.google.com/p/sympy/issues/detail?id=1920

most objects have the relationship that

expr.func(*expr.args)

returns the original object.  This does not work for SymTuple:

Type "help", "copyright", "credits" or "license" for more information.
from sympy import *
from sympy.physics.secondquant import SymTuple
var('x');y=SymTuple((x,))
x
y
SymTuple(x)
y.func(*y.args)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sympy\physics\secondquant.py", line 154, in __new__
    obj = Basic.__new__(cls,*arg_tuple, **kw_args)
TypeError: __new__() argument after * must be a sequence, not Symbol


In this case, one must use y.func(y.args). It would be nice if it's
behavior were consistent with other sympy objects. I think it might be as
easy as wrapping the tuple as a singleton tuple.

y.func(*((x,),))
SymTuple(x)


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

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

Reply via email to