Negroup - wrote:
> Hi.
> 
> My application hosts a module A that contains only a (variable) number
> of functions. In another part of this application I need to know which
> functions are defined inside module A. Initially I thought to use
> __dict__, but along with the functions of module A are listed all the
> builtins too.
> 
> How is possible to obtain this information without defining
> return_all_functions() (see below)?

How about a return_all_functions() that uses introspection?

def return_all_functions(module):
  callables = []
  for name in dir(module):
    value = getattr(module, name)
    if callable(value):
      callables.append(value)
  return callables

Kent

-- 
http://www.kentsjohnson.com

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to