title: How to seperate ' test(a =10)' and 'test' in python
body: <p>I want to do this:</p>
  
  <pre><code>a = TestClass1() &lt;br&gt;
  a.test.fun()   #==&gt; this i want to call TestClass2 method fun() &lt;br&gt;
  a.test(a=10).fun() #===&gt; this i want to call TestClass3 method fun() &lt;br&gt;
  </code></pre>
  
  <p>Does anyone know how to separate this?</p>
  
  <p>I have three classes:</p>
  
  <pre><code>class TestClass1:
      aa = ""
      def __init__(self):
          self.aa = "ccc"
      def __getattr__(self, item):
          print("test 1 get attr = ",item)
          return TestClass2()  or TestClass3()  #==&gt; I don't how to seperate test and test(a =10)
      def __getitem__(self, item):
          print("__getitem__",item)
  
  class TestClass2:
      def __call__(self, *args, **kwargs):
          print("TestClass2  __call__ ")
          return self
      def fun(self):
          print("this TestClass2 fun()")
  
  class TestClass3:
      def __call__(self, *args, **kwargs):
          print("TestClass3  33333 call 3 ")
          return self
      def fun(self):
          print("this TestClass3 fun()")
  </code></pre>