Почернина Ольга, 528 группа MetaBool 17021 | Михальцов Данила, 528 MetaBool 16990 | ||||
---|---|---|---|---|---|
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): | ||
4 | 4 | ||||
t | 5 | def _bool(self): | t | 5 | def new_bool(self): |
6 | return all((getattr(self, a, False) for a in self.__dict__)) | 6 | return all((getattr(self, field, None) for field in self.__dict__)) | ||
7 | dct['__bool__'] = _bool | 7 | dct['__bool__'] = new_bool | ||
8 | return super().__new__(cls, name, bases, dct) | 8 | return super().__new__(cls, name, bases, dct) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|