n | class Mix: | n | class Mixed: |
| | | |
| def __init__(self, **kwargs): | | def __init__(self, **kwargs): |
| self.__dict__.update(kwargs) | | self.__dict__.update(kwargs) |
| | | |
| def __str__(self): | | def __str__(self): |
n | return ', '.join((f'{key}={value}' for key, value in sorted(self | n | return ', '.join((f'{key}={val}' for key, val in sorted(self.__d |
| .__dict__.items()))) | | ict__.items()))) |
| | | |
| def mix(*args): | | def mix(*args): |
t | comb = {} | t | res = {} |
| for a in args: | | for arg in args: |
| for c in dir(a): | | for key in dir(arg): |
| if not c.startswith('_') and (not callable(getattr(a, c))): | | if not key.startswith('_') and (not callable(getattr(arg, ke |
| | | y))): |
| comb[c] = getattr(a, c) | | res[key] = getattr(arg, key) |
| return Mix(**comb) | | return Mixed(**res) |