module functions list

Diez B. Roggisch deetsNOSPAM at
Wed Aug 25 13:45:11 CEST 2004


this strikes me as a pretty basic question, but google didn't help, so I'm
asking it here:

How do I get a list of functions defined in a module in the module itself?
Like this:

--- module
def foo():
    return 1

def bar():
    return 1

def all_functions():
    return <some magic code that yields [foo, bar]>


The application for this is that I want a bunch of predefined functions for
a small expression interpreter of mine to be collected in one module and
get them all without an explicit "registration" process.

Any ideas?


Diez B. Roggisch

More information about the Python-list mailing list