I am trying to get new random name every time I call class. I am defining it as
def namemethod(): return ''.join(random.choice(string.lowercase) for x in range(5)) class Test(object): def __init__(self, name=namemethod()): self.name = name And I am calling Test class via for loop to get new name but I keep getting same name, isn't it suppose to call init method and get new random name?
for i in range(5): person = Test() print person.name Why person = Test() not calling namemethod everytime?
string.lowercase??