f | def sloter(fields, default): | f | def sloter(fields, default): |
| | | |
n | class Class: | n | class klass: |
| __slots__ = fields | | __slots__ = fields |
| | | |
| def __init__(self): | | def __init__(self): |
n | for attr in self.__slots__: | n | for field in klass.__slots__: |
| setattr(self, attr, default) | | setattr(self, field, default) |
| | | |
| def __delattr__(self, attr): | | def __delattr__(self, attr): |
| setattr(self, attr, default) | | setattr(self, attr, default) |
| | | |
| def __iter__(self): | | def __iter__(self): |
| for attr in self.__slots__: | | for attr in self.__slots__: |
| yield getattr(self, attr) | | yield getattr(self, attr) |
t | return Class | t | return klass |