Basic object python

Python -- Posted on Aug. 23, 2017

Basic object python

              
                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__
                  
   
            

Related Posts