algs=['fifo', 'lru', 'liu'] refstring=[3,4,6,8,7,5,1,3,1,5,6,0,4,5,2,7,4,3,2,7,0,3,3,6,3] framesizes=[3,4,5] # number of frames to test against algorithm algpgm={} ... for alg in algs: execfile(alg+'.py') # define the replacement class algpgm[alg]=eval(alg+'()') # instantiate the class ... for numframes in framesizes: # test algorithm on this many frames ... for p in refstring: ...algpgm[alg].ref(p,w) # invoke the ref method dynamically ... ...