I need to create multiple instances of function def name_VARIABLE_NUMBER(self): under one class.
The number of instances will be determined from the input file and is unknown from the beginning. Is it possible to run something like this?
NUMBER_of_INSTANCES = 10
class test:
def instance_1(self):
print (str(1**3))
def instance_2(self):
print (str(2**3))
...
def instance_10(self):
print (str(9**3))
I want to create loop for making different function names under one class with option to call them with test.instance_NUMBER.
What is the best option to create multiple and unknown number of defs with different names inside class?
The initial code can be found here. It is the mayavi scenes. They will be read from input files - so, the number of scenes is unknown from the beginning. And name for the each scene should be different.