My goal is to create a function that will procedurally generate a series of other functions within a class from serialized data. This is easy enough using dict , but... i would like for each function to be initialized with the @property decorator (or a similar custom decorator) so that i can call these functions like attributes
Basically, I would like to do something like the following:
class myClass(object):
def __init__(self):
self.makeFuncs(['edgar','allan','poe'])
def makeFuncs(self, data):
for item in data:
self.__dict__[item] = '[%s] <--- is_the_data' % item
myInstance = myClass()
print myInstance.poe
#'[poe] <--- is_the_data'
Got any Ideas?