Can I use the getattr functionality in a module?

Raymond E. Suorsa (grendel@windchime.arc.nasa.gov)
19 Mar 1995 02:16:45 GMT

Hello again,

While working on my python khoros interface a question came to me. I
know how to use the getattr method while building a type within "C".
I was wondering if I could do the same but from within the module
interface itself. I would like to bind methods to my module
on-the-fly. For example:

If some one trys this:

import khoros

a = khoros.get("lenna.xv")

q = khoros.kflip(a)

I would like to be able to trap the call to kflip in my "C" code and
query the khoros system to see if kflip is a valid method. This way I
can interface to all of khoros and only bring into-the-interface often
used methods, leaving seldom used methods to be dynamically bound.

This may sound strange to those unfamiliar with khoros. Khoros can
communicate though a shared memory transport. Thus for seldom used
functions I can mirror my python objects in shared memory and have a
khoros process grab it, process it, and shove a new object back into
shared memory. I have this working right now... even with some
limited caching. Since khoros has about a gazillion functions I was
hoping to try for a dynamic binding at first... any suggestions?

Thanks,

--

__o Ray Suorsa \<, grendel@windchime.arc.nasa.gov (pgp capable) ()/ () NASA/Ames:USA (Lab) +1 415-604-6334 (Office) +1 415-604-5451