AutoFill Class

class kwhelp.decorator.AutoFill(*args, **kwargs)[source]

Class decorator that replaces the __init__ function with one that sets instance attributes with the specified argument names and default values. The original __init__ is called with no arguments after the instance attributes have been assigned.

Example

>>> @AutoFill('a', 'b', c=3)
... class Foo: pass
>>> sorted(Foo(1, 2).__dict__.items())
[('a', 1), ('b', 2), ('c', 3)]