Modul gotchas:)

Giorgi Lekishvili gleki at gol.ge
Thu Jan 3 00:08:29 CET 2002


Right!

thank you for the help!

Wolfgang Strobl wrote:

> Giorgi Lekishvili <gleki at gol.ge> schrieb am Wed, 02 Jan 2002 14:35:32
> -0800:
>
> >However, when I applied this to the 'math' module, it yielded []...
> >I must have missed something.
>
> Well, it depends on how you define "function". Are you perhaps looking
> for builtin functions too? What about callable items?
>
> >
> >If I have all_func list of the function names, i.e., strings, not
> >pointers, I can do something like this:
> >
> >class someClass:
> >    ....
> >
> >    def getVector(self, names):
> >        vector=[]
> >        import myModule
> >        all_func=myModule.some_way_to_get_the_names()
> >        for name in names:
> >            if name in all_func:
> >                f=eval('myModule.'+name)
> >                vector.append(f(self.somthing))
> >        return vector
>
> Why don't you just use a list of functions and "apply"?
>
> --
> #define print void main(){ printf(
> print "signature under construction"
> #define pass );}
> pass




More information about the Python-list mailing list