On Thu, Aug 2, 2012 at 5:36 AM, gsagrawal <[email protected]> wrote:
>
> Thanks ,
> Ghanshyam Agrawal
> Developer ,Mettl (math.mettl.com)
> Gurgaon,
> Contact No : 9717167192
>
>
>
> On Thu, Aug 2, 2012 at 2:37 PM, Aaron Meurer <[email protected]> wrote:
>>
>> This is a bug.  The reason that it didn't do it before was that we
>> didn't have the Tuple() object.  Now that we do, 'x*()' is converted
>> to Symbol('x')*Tuple(), and unfortunately, Mul doesn't do any type
>> checking and so allows Tuple in its args.
>>
>> I'm not sure what the correct fix is.  Should Mul check if its args are
>> Expr?
>>
> this is doable but again ,this is not limited to Mul  ,we have to check in
> Add/Pow also.
> But if you try to do sympify("x*{}") ,it throws error that "unsupported
> operand type". Cant we just add tuple also over there. i coudnt find the
> exact location where we are throwing this error . can any one guide.

The error comes from the fact that {} is not converted by sympify().
The error itself is a result of x.__mul__ returning NotImplemented for
non-sympy types.  Python then tries {}.__rmul__(x), which also returns
NotImplemented, so it raises a TypeError (Python itself does this, not
us).

So I think to fix this we either need to do more type checking in Mul,
or refactor the logic in to subclasses' dispatch methods (basically
what Ronan is working on).

Aaron Meurer

>
>>
>> Aaron Meurer
>>
>> On Thu, Aug 2, 2012 at 2:52 AM, gsagrawal <[email protected]> wrote:
>> > In current version
>> > r="x*()"
>> > print sympify(r)  #prints x*()
>> >
>> > But it was throwing error "TypeError: can't multiply sequence by non-int
>> > of
>> > type 'Symbol'" in earlier versions (0.7.1/http://live.sympy.org/)
>> >
>> > What is reason ? and any suggestion on how can i fix this ?
>> >
>> >
>> > Thanks,
>> > Ghanshyam Agrawal
>> > Developer : math.mettl.com
>> >
>> >
>> > --
>> > 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.
>>
>
> --
> 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