OK. I added a pull request: https://github.com/sympy/sympy/pull/8307
On Friday, October 24, 2014 4:24:41 PM UTC-5, Aaron Meurer wrote: > > Go ahead and open a pull request with this change, and we can review > it, and see if it breaks any tests, and so on. > > Aaron Meurer > > On Fri, Oct 24, 2014 at 7:55 AM, Duane Nykamp <dqny...@comcast.net > <javascript:>> wrote: > > The following throws an error > > > > In [27]: f=Function('f') > > > > In [28]: parse_expr('af(t)', local_dict={'f': f }, > > transformations=(auto_symbol, auto_number, split_symbols, > > implicit_multiplication)) > > > --------------------------------------------------------------------------- > > TypeError Traceback (most recent call > last) > > > > [snip] > > > > TypeError: unbound method as_base_exp() must be called with f instance > as > > first argument (got nothing instead) > > > > > > The code it is trying to evaluate is > > > > Symbol ('a' )*(f )*(Symbol ('t' )) > > > > It seems the problem is the parentheses around f that were inserted in > line > > 394: > > result.extend([(OP, '('), (NAME, "%s" % > char), > > (OP, ')'), > > (NAME, 'Symbol'), (OP, '(')]) > > > > Is there any reason to add those parenthesis? Certainly, if char is a > > function, they should not be added. I'm not sure if there are cases > where > > one does need those parenthesis. > > > > I can fix the problem by changing this line to > > result.extend([(NAME, "%s" % char), > > (NAME, 'Symbol'), (OP, '(')]) > > but I'm not sure if I should test if local_dict[char] or > global_dict[char] > > is callable (similar to _get_token_callable) and only remove the > parenthesis > > if it is callable. > > > > For this to work, I also have to modify the approach to remove the last > 2 > > tokens (rather than 3) and then skip the following token so that the > close > > parenthesis from the original Symbol is not included. > > > > Does this fix seem reasonable? > > > > Duane > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "sympy" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to sympy+un...@googlegroups.com <javascript:>. > > To post to this group, send email to sy...@googlegroups.com > <javascript:>. > > Visit this group at http://groups.google.com/group/sympy. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/sympy/5a8ffc92-3be1-4c60-aa0e-0765b20048f3%40googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/f93040fa-40d2-4214-874d-1b75c353ceea%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.