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