pylint-errors

E0237 (assigning-non-slot)

:x: Problematic code:

class Foo:
    __slots__ = ('bar',)

    def __init__(self, bar, baz):
        self.bar = bar
        self.baz = baz
        self.setup()

    def setup(self):
        pass

:heavy_check_mark: Correct code:

class Foo:
    __slots__ = ('bar', 'baz')

    def __init__(self, bar, baz):
        self.bar = bar
        self.baz = baz
        self.setup()

    def setup(self):
        pass

Rationale:

Used when assigning to an attribute not defined in the class slots.