AutoFillKw Class

class kwhelp.decorator.AutoFillKw(cls)[source]

Class decorator that replaces the __init__ function with one that sets instance attributes with the specified key, value of kwargs. The original __init__ is called with any *args after the instance attributes have been assigned.

Example

>>> @AutoFillKw
... class Foo: pass
>>> sorted(Foo(a=1, b=2, End="!").__dict__.items())
[('End', '!'), ('a', 1), ('b', 2)]