pythonクラスメソッドのパラメータにデフォルト値を使用する方法

872 ワード

class A():
    __init__(self, **arg): self.__dict__.update(arg)

       def M(self, config=None, section=None):
             if config is None:
                  config = self.config
             if section is None:
                  section = self.section
 
 
 
ソース:https://www.zhihu.com/question/22959976/answer/23246445
転載先:https://www.cnblogs.com/white-small/p/6349605.html