f | def sloter(fields, default): | f | def sloter(fields, default): |
| | | |
n | class gen_class: | n | class my_class: |
| __slots__ = fields | | __slots__ = fields |
| | | |
| def __init__(self): | | def __init__(self): |
n | for field in self.__slots__: | n | for i in self.__slots__: |
| setattr(self, field, default) | | setattr(self, i, default) |
| | | |
| def __iter__(self): | | def __iter__(self): |
n | for field in self.__slots__: | n | for i in self.__slots__: |
| if hasattr(self, field): | | if hasattr(self, i): |
| yield getattr(self, field) | | yield getattr(self, i) |
| | | |
| def __delattr__(self, field): | | def __delattr__(self, field): |
| if hasattr(self, field): | | if hasattr(self, field): |
| setattr(self, field, default) | | setattr(self, field, default) |
t | return gen_class | t | return my_class |