James Stroud <[EMAIL PROTECTED]> writes:
>       Module            Behavior
>    ==============  ====================================================
>     UserDefined1   Imports FunctionUser
>     ThirdParty     Contains User Functions (May be ==UserDefined1)
>     FunctionUser   do_something_with() and/or get_function_from_name()
> 
> So the name-to-function mapping is done in FunctionUser but the
> function is actually defined in UserDefined1 (or ThirdParty if
> ThirdParty is different than UserDefined1).

I'm still completely confused.  Does FunctionUser know what module the
user functions are supposed to come from?  Could you give an example
of what you want the actual contents of those 3 modules to look like?
E.g.:

    UserDefined1.py:
      import FunctionUser

      def foo(x):
          print x+3

    FunctionUser.py:
       def do_something_with (module, funcname, *args, **kw):
         func = getattr(module, funcname)
         func (*args, **kw)

    main.py:
       import UserDefined1, FunctionUser

       # the following should print 10
       FunctionUser.do_something_with(UserDefined1, 'foo', 7)

I don't think the above is quite what you want, but is it somewhere
close?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to