f | def sloter(fields, default): | f | def sloter(fields, default): |
| | | |
n | class A: | n | class cls: |
| __slots__ = fields | | __slots__ = fields |
| | | |
| def __init__(self): | | def __init__(self): |
| for field in self.__slots__: | | for field in self.__slots__: |
| setattr(self, field, default) | | setattr(self, field, default) |
| | | |
| def __delattr__(self, field): | | def __delattr__(self, field): |
| setattr(self, field, default) | | setattr(self, field, default) |
| | | |
| def __iter__(self): | | def __iter__(self): |
t | return iter([getattr(self, field) for field in self.__slots__]) | t | return iter((getattr(self, field) for field in self.__slots__)) |
| return A | | return cls |