Guys, help me figure out how to pass a list of arguments to the class constructor and loop through this list?
class A(): def __init__(self,*name): self.name = name def func(self): if self.name == 'a': print ('aaa') elif self.name == 'b': print ('bbb') elif self.name == 'c': print ('ccc') By tyke method I realized that it is possible to pass arguments there, in fact, through a cycle:
letters = ['a','b','c'] for i in letters: letters = A(i) letters.func() But somehow it seems to me cumbersome. Maybe there is a more "correct" way?