Hypothetically speaking, assume one has this class
:
class Person:
def __init__(self, lastName, firstName, age,):
self.lastName = lastName
self.firstName = firstName
self.age = age
To add other attributes, it would be the same method. However, writing self.attribute = attribute
would become extremely tiresome after a while, especially if a dozen or more attributes were required, in cases of a larger class.
Is there some way to iteratively apply the variable name to the attribute? Perhaps by setting up a loop and applying the attributes autonomously?