On 10/20/2010 11:49 PM, Zachary Pincus wrote:
>> Hi Robert,
>> so in a big data analysis framework, that is essentially written in C
>> ++,
>> exposed to python with SWIG, plus dedicated python modules, the user
>> performs an analysis choosing some given modules by name,as in :
>> myOpt="foo"
>>
Johann Cohen-Tanugi wrote:
> On 10/20/2010 11:10 PM, Robert Kern wrote:
>
>> On Wed, Oct 20, 2010 at 15:58, Johann Cohen-Tanugi
>> wrote:
>>
>>
>>> On 10/20/2010 10:35 PM, Nathaniel Smith wrote:
>>>
>>>
>>
>>
IMPORTANT USAGE NOTE: never do this :-)
On Wed, Oct 20, 2010 at 16:49, Zachary Pincus wrote:
> But why not have the user just pass in the relevant optObject from the
> pyOpt namespace (or some restricted namespace that just has the
> relevant functions exposed)? E.g.
> my_analysis.perform(optimizer=pyOpt.Amoeba)
> rather than
> my_anal
> Hi Robert,
> so in a big data analysis framework, that is essentially written in C
> ++,
> exposed to python with SWIG, plus dedicated python modules, the user
> performs an analysis choosing some given modules by name,as in :
> myOpt="foo"
> my_analyse.perform(use_optimizer=myOpt)
>
> The attri
On 10/20/2010 11:10 PM, Robert Kern wrote:
> On Wed, Oct 20, 2010 at 15:58, Johann Cohen-Tanugi
> wrote:
>
>> On 10/20/2010 10:35 PM, Nathaniel Smith wrote:
>>
>
>>> IMPORTANT USAGE NOTE: never do this :-)
>>>
>>>
>> What would you recommand? I do encounter situations where
On Wed, Oct 20, 2010 at 1:58 PM, Johann Cohen-Tanugi
wrote:
> On 10/20/2010 10:35 PM, Nathaniel Smith wrote:
>> The better way to do this is:
>>
>> import inspect
>> def call_this(fname, x):
>> caller_frame = inspect.currentframe().f_back
>> f = caller_frame.f_locals.get(fname, caller_frame.f_
On Wed, Oct 20, 2010 at 15:58, Johann Cohen-Tanugi wrote:
> On 10/20/2010 10:35 PM, Nathaniel Smith wrote:
>> IMPORTANT USAGE NOTE: never do this :-)
>>
> What would you recommand? I do encounter situations where I need
> instantiation based on the name of the thing to instantiate, typically
> pa
On 10/20/2010 10:35 PM, Nathaniel Smith wrote:
> On Wed, Oct 20, 2010 at 6:51 AM, Johann Cohen-Tanugi
> wrote:
>
>> If you really need to pass the function name :
>> In [3]: def my_func(x):
>> ...: return 2*x
>>
>> In [4]: def caller(fname,x):
>> ...: return eval("%s(%f)"%(f
On Wed, Oct 20, 2010 at 6:51 AM, Johann Cohen-Tanugi
wrote:
> If you really need to pass the function name :
> In [3]: def my_func(x):
> ...: return 2*x
>
> In [4]: def caller(fname,x):
> ...: return eval("%s(%f)"%(fname,x))
>
> In [5]: caller("my_func",2)
> Out[5]: 4.0
The better w
On Wed, 2010-10-20 at 13:18 -0400, Alan G Isaac wrote:
> On 10/20/2010 9:42 AM, Thomas Kirk Gamble wrote:
> > I'm trying to write an implementation of the amoeba function from
> > numerical recipes and need to be able to pass a function name and
> > parameter list to be called from within the amoeb
On 10/20/2010 9:42 AM, Thomas Kirk Gamble wrote:
> I'm trying to write an implementation of the amoeba function from
> numerical recipes and need to be able to pass a function name and
> parameter list to be called from within the amoeba function.
1. Have you checked whether this might already be
On Wed, 2010-10-20 at 09:46 -0400, Zachary Pincus wrote:
> > I'm trying to write an implementation of the amoeba function from
> > numerical recipes and need to be able to pass a function name and
> > parameter list to be called from within the amoeba function. Simply
> > passing the name as a str
On Wed, Oct 20, 2010 at 9:46 AM, Zachary Pincus wrote:
>> I'm trying to write an implementation of the amoeba function from
>> numerical recipes and need to be able to pass a function name and
>> parameter list to be called from within the amoeba function. Simply
>> passing the name as a string d
If you really need to pass the function name :
In [3]: def my_func(x):
...: return 2*x
In [4]: def caller(fname,x):
...: return eval("%s(%f)"%(fname,x))
In [5]: caller("my_func",2)
Out[5]: 4.0
On 10/20/2010 03:46 PM, Zachary Pincus wrote:
>> I'm trying to write an implementation
> I'm trying to write an implementation of the amoeba function from
> numerical recipes and need to be able to pass a function name and
> parameter list to be called from within the amoeba function. Simply
> passing the name as a string doesn't work since python doesn't know it
> is a function and
I'm trying to write an implementation of the amoeba function from
numerical recipes and need to be able to pass a function name and
parameter list to be called from within the amoeba function. Simply
passing the name as a string doesn't work since python doesn't know it
is a function and throws a
16 matches
Mail list logo