I often find myself writing class constructors like this:
class foo: def __init__(self, arg1, arg2, arg3): self.arg1 = arg1 self.arg2 = arg2
class foo: def __init__(self, **kwargs): for arg_name, arg_value in kwargs.items(): setattr(self, arg_name, arg_value)
This requires arguments to be named:
obj = foo(arg1 = 1, arg2 = 2)