This validation can be also done with the use of annotations, while I find it super awful, I put this for one more example:
from functools import wraps def validate(func): @wraps(func) def _wrap(self, *args, **kwargs): variables = func.__annotations__.keys() kwargs.update(zip(variables, args)) for var in variables - kwargs.keys(): kwargs[var] = getattr(self, var) return func(self, **kwargs) return _wrap class Foo: def __init__(self, bashful, doc, dopey, grumpy, happy, sleepy, sneezy): self.bashful = bashful self.doc = doc self.dopey = dopey self.grumpy = grumpy self.happy = happy self.sleepy = sleepy self.sneezy = sneezy @validate def spam(self, bashful:'Any'=None, doc:'Any'=None, dopey:'Any'=None, grumpy:'Any'=None, happy:'Any'=None, sleepy:'Any'=None, sneezy:'Any'=None): return bashful, doc, dopey, grumpy, happy, sleepy, sneezy a = Foo(1,2,3,4,5,6,7) a.spam(grumpy='Hello') With kind regards, -gdg -- https://mail.python.org/mailman/listinfo/python-list