running a random function

Matimus mccredie at
Thu Jun 7 18:50:30 CEST 2007

How are you making the list of functions? Something like this:

fs = []
for k,f in globals():
    if callable(f):

Then to call a random one (assuming they all take no parameters):

import random

Or maybe you only have the name of the function, this should work:


Does this help? I'm not really clear on what you are asking for.

More information about the Python-list mailing list