How to pass a reference to the current module

Paul Rubin http
Fri Aug 3 21:36:40 EDT 2007


James Stroud <jstroud at mbi.ucla.edu> writes:
> > please describe less abstractly what you're trying to do.
> You sound like my former thesis adviser.

I couldn't understand what you were trying to do either.

> OK. From an external source, such as configuration file, the user will
> specify the *name* of a function somehow with the assumption that the
> function will be coded somewhere (in the present or other modules) by
> that name.

Is something wrong with 

   import some_module
   func = getattr(some_module, func_name)

?



More information about the Python-list mailing list