pylint #9018 when using defining-attr-method, method order matters [resolved]

Consider this simple class:

class C:
    def __init__(self):
        self.x = 0

    def set_y(self, y):
        self.y = y

    def set_x(self, x):
        self.x = x

    def reset(self):
        self.x = 0
        self.y = 0

If you run pylint over it like so:

pylint --defining-attr-methods=__init__,reset

it complains: [W, C.set_y] Attribute 'y' defined outside __init__

If, however, you reorganize it slightly so that reset() occurs before set_y, pylint is happy. I can understand why this error is emitted. Pylint sees the definition of self.y in set_y before it encounters reset and thus emits the error message.

It seems to me that giving a bunch of attributes initial values is generally of secondary importance to a class's functionality. It should be ok to push such methods to the end of the file. I think pylint should collect the location of attribute initialization as it runs and only report on attributes which are not ever assigned in the methods specified by defining-attr-methods, ignoring when they are encountered.

appeared in<not specified>
done in0.21.0
load left0.000
closed by<not specified>