Right.  This is of course a lot of work to make all the SymPy
functions do type checking, but if you look at the traceback, it's
actually coming from Function.__new__.  So maybe we should just make
sure that the core functions do type checking.

Or maybe we should add an option to sympify() that raises an exception
if the returned object is not Basic and have the core functions call
that (perhaps _sympify() should do this?).

Aaron Meurer

2011/11/9 Ondřej Čertík <ondrej.cer...@gmail.com>:
> On Wed, Nov 9, 2011 at 8:35 AM, Aaron Meurer <asmeu...@gmail.com> wrote:
>> 2011/11/8 Ondřej Čertík <ondrej.cer...@gmail.com>:
>>> On Tue, Nov 8, 2011 at 4:15 PM, Roberto Colistete Jr.
>>> <roberto.colist...@gmail.com> wrote:
>>>>    Hi,
>>>>
>>>>    On SymPy 0.6.7 the 'diff' function works on lists. But on SymPy
>>>> 0.7.1 it doesn't, for example :
>>>>
>>>> In [1]: diff([cos(t), sin(t), exp(t), t)
>>>> ---------------------------------------------------------------------------
>>>> AttributeError                            Traceback (most recent call
>>>> last)
>>>> /home/roberto/<ipython-input-6-14d9fa9d6a32> in <module>()
>>>> ----> 1 diff([cos(t),sin(t),t],t)
>>>>
>>>> /usr/local/lib/python2.6/dist-packages/sympy/core/function.pyc in
>>>> diff(f, *symbols, **kwargs)
>>>>   1104     """
>>>>   1105     kwargs.setdefault('evaluate', True)
>>>> -> 1106     return Derivative(f, *symbols, **kwargs)
>>>>   1107
>>>>   1108 def expand(e, deep=True, modulus=None, power_base=True,
>>>> power_exp=True, \
>>>>
>>>> /usr/local/lib/python2.6/dist-packages/sympy/core/function.pyc in
>>>> __new__(cls, expr, *symbols, **assumptions)
>>>>    672         if evaluate:
>>>>    673             if set(sc[0] for sc in symbol_count
>>>> --> 674                   ).difference(expr.free_symbols):
>>>>    675                 return S.Zero
>>>>    676
>>>>
>>>> AttributeError: 'list' object has no attribute 'free_symbols'
>>>
>>>
>>> ^^^ I was getting this "no attribute 'free_symbols'" error couple
>>> times when I was trying to integrate something (I think). The error is
>>> not informative and the code should be refactored to produce a
>>> readable error message showing what is wrong and why.
>>>
>>> The above error message looks like a bug in sympy.
>>>
>>> Ondrej
>>
>> If you got this by using regular SymPy input, then it is definitely a
>> bug.  The problem here was that the input was not SymPy input, so any
>> function that assumes that it is would fail (and also, currently
>> sympify() does nothing to lists).
>
> The problem was that I was passing some incorrect arguments. So the
> user API should say: this argument is incorrect, or can't be converted
> to a sympy argument, rather than some "no attribute" error. It took me
> couple minutes to figure out that the problem is actually on my side,
> that I am passing there some incorrect arguments.
>
> Ondrej
>
> --
> 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.

Reply via email to