---------- Forwarded message ----------
Date: Wed, 28 Sep 2005 17:11:07 -0700
From: DS <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re: [Tutor] call a def/class by reference
Danny Yoo wrote:
>
>
>>Thanks for answering my question. What I'm hoping to avoid is an
>>explicit reference to any of the called functions within the program.
>>By doing it that way, it would avoid a maintenance problem of having to
>>remember to put a reference for every new function in the calling
>>program.
>>
>>
>
>
>In your list of requirements:
>
>
>
>> 1. gettting the input that consists of a function and its
>> parameters,
>> 2. determining if the function is on an approved function list,
>> 3. executing the function
>> 4. rinse, repeat.
>>
>>
>
>the second one is probably the one that needs clarifying.
>
>How do you know which functions should be callable? Adam's approach to
>expressing that knowledge is to use a dictionary:
>
> d = {"foo" : foo}
>
>And there are many other ways of doing this besides a hardcoded
>dictionary.
>
>Tell us more about what you mean for a function to be "approved", and we
>should be able to suggest practical ways to do what you want.
>
>
>
>
As far as an "approved" function, what I was imagining was something along
the lines of importing modules where all functions are callable such as
approvedlist = dir(mymodule)
which would give a list of names and then going from there.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor