I am trying to create a class with lots of attributes (about 10). Is there a prettier (more Pythonic) way to initiate the class than:
class myClass:
def __init__(self,atributeA,atributeB,atributeC)
self.atributeA=atributeA
self.atributeB=atributeB
self.atributeC=atributeC
and is there a better way to make a class instance than
thisInstance=myClass(valueA,valueB,valueC)
Well, you could use keyword arguments. It would be as simple as:
One of the advantages of this is that you can pass the values in any order you want.
You don’t even have to modify the class definition at all.