title: Python: Create a single object for a set of arguments to the constructor
body: <p>What should be done to return the same object for the same set of arguments to the constructor instead of creating a new object at every class instantiation call. The code should only create a new object if it finds a new set of arguments in the constructor.</p>
  <pre><code>class Test1(object):
      def __init__(self, arg1, arg2, arg3):
          self.arg1 = arg1
          self.arg2 = arg2
          self.arg3 = arg3
  
      def func1(self):
          pass
  
      def func2(self):
          pass
  
  if __name__ == &quot;__main__&quot;:
      ob1 = Test1(&quot;a1&quot;, &quot;a2&quot;, &quot;a3&quot;)
      ob2 = Test1(&quot;a1&quot;, &quot;a2&quot;, &quot;a3&quot;)
      ob3 = Test1(&quot;b1&quot;, &quot;b2&quot;, &quot;b3&quot;)
  
      print(ob1 == ob2)     # Prints False
      print(ob1 == ob3)     # Prints False
  </code></pre>
  <p>So, is there any implementation technique or any design pattern which returns the already created object if the same set of arguments are passed, that is, in the above example ob1 and ob2 should point to the same object?</p>
  <p>Any help would be appreciated. Thank you.</p>