I am new to python and am wondering is it possible to name a method after a variable. I know I can name a variable after another variable using
test = "temp" vars()[test] = 123 print temp
this will print 123. so I was thinking something like this for a method:
class myClass: def __init__(self, methodName): self.vars()[methodName]= "This is the result" methodName = "myMethod" o = myClass(methodName) print o.myMethod
I know it seems long winded but I have a bigger picture in mind.
Thanks in advance for any replies.