I'm making a videogame in Python and I would like to avoid writing all the self.parameter1 = parameter 1
in each class I'm creating.
I looked up for a way to automatize this process both in YouTube and Stack Overflow, but I found nothing.
Is also possible I'm making a mistake creating a class that contains so many parameters?
P.S: I tried this idea of using a function to automatize the process, but maybe because I'm new to programming, I'm making mistakes, or maybe was just a bad idea (I get mistakes about unresolved references of self
, a
, b
, ...).
Just in case I'll leave the code I tried here:
def lazy:
for parameter in parameters:
return self.parameter == parameter
global parameters (a
, b
, c
, d
, e
, f
)
class npc:
def __init__(self, parameters):
lazy()