I think the proper fix is to either make DeferredVector an Expr object
or give it a _sympy_ method so that sympify() knows how to convert it
without resorting to trying to iterate over it.

Actually, I see now that DeferredVector is a generator of Symbol
objects.  So expr.subs(x, newt) makes about as much sense as
expr.subs(x, cos) (that's not a typo).

I think this previously only worked because sympify converted the
string value into a Symbol (converting string values is sympify()'s
last resort).  If you had given it some string name that wasn't an
allowable Python variable name, or something strange like
DeferredVector('cos(x)'), it would have behaved much different.

In [1]: x.subs(x, DeferredVector('cos(x)'))
Out[1]: cos(x)

In [2]: x.subs(x, DeferredVector('cos(x)')).subs(x, pi)
Out[2]: -1

Aaron Meurer
On Mon, Jul 25, 2011 at 9:40 PM, Chris Smith <[email protected]> wrote:
> On Mon, Jul 25, 2011 at 7:46 PM, Aaron Meurer <[email protected]> wrote:
>> Tracking it down was easy.  The thing I'm not sure about is how to
>> properly fix this. Any objects that iterates infinitely would have
>> this problem.
>>
>
> I can't look into this too deeply now, but is there an exclude flag on
> the iterable() function that can be used to exclude the object in
> question?
>
> --
> 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.

Reply via email to