Юань Дунлян, 523 Группа MetaBool 17373 | Дзюба Мария, 517 MetaBool 17114 | ||||
---|---|---|---|---|---|
f | 1 | class empty(type): | f | 1 | class empty(type): |
2 | 2 | ||||
3 | def __new__(cls, name, bases, dct): | 3 | def __new__(cls, name, bases, dct): | ||
n | 4 | x = super().__new__(cls, name, bases, dct) | n | 4 | new_cls = super().__new__(cls, name, bases, dct) |
5 | 5 | ||||
n | 6 | def __bool__(self): | n | 6 | def check_if_empty(self): |
7 | for attr in self.__dict__.values(): | 7 | for attr in vars(self).values(): | ||
8 | if not attr: | 8 | if not attr: | ||
9 | return False | 9 | return False | ||
10 | return True | 10 | return True | ||
t | 11 | x.__bool__ = __bool__ | t | 11 | new_cls.__bool__ = check_if_empty |
12 | return x | 12 | return new_cls |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|