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