1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
class Foo: """docstring""" __slots__ = ['attr'] class Bar: """docstring""" __slots__ = {'attr1': 'docstring of attr1', 'attr2': 'docstring of attr2', 'attr3': None} __annotations__ = {'attr1': int} def __init__(self): self.attr2 = None #: docstring of instance attr2 class Baz: """docstring""" __slots__ = 'attr'