Тулин Дмитрий Ильич, 528 группа MetaBool 16570 | Бислан Ашинов, 530 группа MetaBool 16854 | ||||
---|---|---|---|---|---|
t | 1 | class empty(type): | t | 1 | class empty(type): |
2 | 2 | ||||
3 | def __new__(cls, name, bases, dct): | 3 | def __new__(cls, name, bases, dct): | ||
4 | new_class = super().__new__(cls, name, bases, dct) | 4 | new_class = super().__new__(cls, name, bases, dct) | ||
5 | 5 | ||||
6 | def __bool__(self): | 6 | def __bool__(self): | ||
7 | return all((bool(value) for value in self.__dict__.values())) | 7 | return all((bool(value) for value in self.__dict__.values())) | ||
8 | setattr(new_class, '__bool__', __bool__) | 8 | setattr(new_class, '__bool__', __bool__) | ||
9 | return new_class | 9 | return new_class |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|