f | def sloter(fields, default): | f | def sloter(fields, default): |
| | | |
n | class klass: | n | class Class: |
| __slots__ = fields | | __slots__ = fields |
| | | |
| def __init__(self): | | def __init__(self): |
n | for field in klass.__slots__: | n | for attr in self.__slots__: |
| setattr(self, field, default) | | setattr(self, attr, 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 klass | t | return Class |