>>On Thursday 29 September 2005 22:26, Alan G wrote:
>>> string -> function mapping directly.
>>>
>>> Its not usually a very useful thing to do
>>
>This is precisely how shared libraries under linux and IIRC DLLs in
>windows work. cf dlopen, dysym in C.
No, its completely different. These are not
> Thanks so much to all of you that have answered my questions, including
> Liam.Clarke-Hutchinson, whom I didn't acknowledge directly with an
> email. I hope I'm not asking too many questions.
Hi ds,
You're doing perfectly fine. *grin* We got to see a lot of different
approaches to that class
On Thursday 29 September 2005 22:26, Alan G wrote:
> string -> function mapping directly.
>
> Its not usually a very useful thing to do
This is precisely how shared libraries under linux and IIRC DLLs in windows
work. cf dlopen, dysym in C.
> how would the typical user know what the function na
Alan G wrote:
>> I'm actually pretty surprised that there isn't a built-in facility with
>> Python for referencing functions like this.
>
>
> I'm not. In fact its pretty unusual in any language to try to map
> from function name to function directly. Dictionaries are the
> universal solution for t
> I'm actually pretty surprised that there isn't a built-in facility
> with
> Python for referencing functions like this.
I'm not. In fact its pretty unusual in any language to try to map
from function name to function directly. Dictionaries are the
universal solution for this, I can only think o
Danny Yoo wrote:
>>>From what I've read so far, globals are actively discouraged. A class
>>seems like the best approach.
>>
>>I'm actually pretty surprised that there isn't a built-in facility with
>>Python for referencing functions like this. In reading Python in a
>>Nutshell, prior to asking
> >From what I've read so far, globals are actively discouraged. A class
> seems like the best approach.
>
> I'm actually pretty surprised that there isn't a built-in facility with
> Python for referencing functions like this. In reading Python in a
> Nutshell, prior to asking my questions here,
bob wrote:
> At 08:23 AM 9/29/2005, DS wrote:
>
>> bob wrote:
>>
>> > At 04:29 PM 9/28/2005, DS wrote:
>> >
>> >> 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
At 08:23 AM 9/29/2005, DS wrote:
>bob wrote:
>
> > At 04:29 PM 9/28/2005, DS wrote:
> >
> >> 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
bob wrote:
> At 04:29 PM 9/28/2005, DS wrote:
>
>> 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
At 04:29 PM 9/28/2005, DS wrote:
>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.
Try this - a
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
-- 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 hop
> 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
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.
ds
Adam wro
How about something like this
def foo(bar):
print bar
d = {"foo":foo}
s = "foo"
params = "bar"
try: d[s](params)
except: KeyError
Then you can just put the allowed functions into the dictionary.On 29/09/05, DS <[EMAIL PROTECTED]
> wrote:Is it possible to call a function or class by reference
16 matches
Mail list logo