I have a metaclass that defines a class level attribute which should be unique for each subclass but shared across instances of each subclass.

```
class MetaValidator(type):
    def __new__(
             cls, name, bases, dct
    ):
        new_cls = super().__new__(cls, name, bases, dct)
        new_cls.valid_funcs = []
        return new_cls

```

Now I'd like to implement a decorator that appends the decorated class method to valid\_funcs within the derived class. However because the derived class is still being defined I don't have a reference to the derived decorator so I end up appending to the base class. Here's my code:

```
class Validator(object, metaclass=MetaValidator):

    @classmethod
    def add(cls, f):
        cls.valid_funcs.append(f)
        return f

    def _validate(self, **kwargs):
        for f in self.valid_funcs:
            params = inspect.signature(f).parameters.keys()
            f_kwargs = {name: kwargs[name] for name in params}
            f(**f_kwargs)

    def validate(self, **kwargs):
        self._validate(**kwargs)

class A(Validator):

    @staticmethod
    @Validator.add
    def test_func(x):
        return x

class B(Validator):

    @staticmethod
    @Validator.add
    def test_func(x, y):
        return x, y

a = A()
a.validate(x="In A")
b = B()
b.validate(x="In B", y=" Called with arg y")

print(Validator.valid_funcs)
print(a.valid_funcs)
print(b.valid_funcs)

```

This prints:

```
[<function A.test_func at 0x7f0189d4fc80>, 
<function B.test_func at 0x7f0189d4fd08>]
[]
[]

```

I want:

```
[]
[<function A.test_func at 0x7f0189d4fc80>]
[<function B.test_func at 0x7f0189d4fd08>]

```