Re: [Tutor] SciPy Optimize-like calling function as string

2017-02-18 Thread Peter Otten
Joseph Slater wrote: > I'm trying to use the scipy.optimize code as an example to be able to > avoid using *eval* to call a function named by a string. > > The following appears to be the code used to do this: No, wrap_function wraps an existing function, adds some extra args, and provides a wa

Re: [Tutor] SciPy Optimize-like calling function as string

2017-02-18 Thread Alan Gauld via Tutor
On 18/02/17 21:52, Joseph Slater wrote: > I'm trying to use the scipy.optimize code ... > I've seen this done with dictionaries on some pages, > but it seems that this is intended to be faster There is a saying in programming that premature optimization is the root of all evil. If you don't know

[Tutor] SciPy Optimize-like calling function as string

2017-02-18 Thread Joseph Slater
I'm trying to use the scipy.optimize code as an example to be able to avoid using *eval* to call a function named by a string. The following appears to be the code used to do this: # from scipy optimize > def wrap_function(function, args): > ncalls = [0] > if function is None: >