Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium EasyToFix

New issue 3531 by [email protected]: IndexedBase does not sympify its arguments
http://code.google.com/p/sympy/issues/detail?id=3531

From the mailing list:

In [1]: L = IndexedBase('L')

In [2]: a,b = map(Idx,['a','b'])

In [3]: exp = 2*L[a,b]

In [5]: p,q = map(Wild,['p','q'])
exp = exp.replace(L[p,q],p)

In [6]: exp
Out[6]: 2⋅a

In [7]: exp = 2*L[1,0]

In [8]: exp.replace(L[p,q],p)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-d0da40415cd4> in <module>()
----> 1 exp.replace(L[p,q],p)

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in replace(self, query, value, map)
   1246                     return None
   1247
-> 1248         result = rec_replace(self)
   1249
   1250         if result is None:

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in rec_replace(expr)
   1222
   1223             for arg in expr.args:
-> 1224                 result = rec_replace(arg)
   1225
   1226                 if result is not None:

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in rec_replace(expr)
   1222
   1223             for arg in expr.args:
-> 1224                 result = rec_replace(arg)
   1225
   1226                 if result is not None:

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in rec_replace(expr)
   1221             args, construct = [], False
   1222
-> 1223             for arg in expr.args:
   1224                 result = rec_replace(arg)
   1225

AttributeError: 'int' object has no attribute 'args'

In [9]: exp = 2*L[S(1),S(0)]

In [10]: exp.replace(L[p,q],p)
Out[10]: 2


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