steveej / python-easy_init

Python decorator for automatically setting arguments to class objects in constructors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

easy_init

Python decorator for automatically assigning arguments to class variables.

It will only assign positional arguments and named arguments, including default values. *args and **kwargs will be ignored.

installation

TODO

usage

Import the module and decorate your classes constructor functions. The following example makes easy_init take care of the class variable assignment.

from easy_init import easy_init

class DummyClass(object):
    @easy_init
    def __init__(self, one, two, three=False, *args, **kwargs):
        pass

About

Python decorator for automatically setting arguments to class objects in constructors

License:GNU General Public License v3.0


Languages

Language:Python 100.0%