dkoug Blog

Basic object python

Python -- Posted on Aug. 23, 2017

Basic object python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
class Myclass:
    _args = []

    def __init__(self, *args, **kwargs):
        if args:
            for arg in args:
                self._args.append(arg)
        if kwargs:
            for key, value in kwargs.items():
                setattr(self, key, value)

    def get_args(self):
        return self._args

    def get_kwargs(self):
        return self.__dict__