f | def sloter(fields, default): | f | def sloter(fields, default): |
| | | |
n | class Wrapped: | n | class Result: |
| __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 | return (getattr(self, obj_name) for obj_name in self.__slots__) | n | return (getattr(self, k) for k in self.__slots__) |
| | | |
| def __delattr__(self, item): | | def __delattr__(self, item): |
| setattr(self, item, default) | | setattr(self, item, default) |
t | return Wrapped | t | return Result |