title: singleton, metaclass and error during instantiation
body: <p>I needed to create a singleton in for my code. So I followed <a href="https://stackoverflow.com/questions/6760685/creating-a-singleton-in-python">these instructions, method 3</a>. </p>
  
  <p>Here is the code that I have:</p>
  
  <pre><code>class Singleton(type):
      _instances = {}
      def __call__(cls, *args, **kwargs):
          if cls not in cls._instances:
              cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
          return cls._instances[cls]
  
  def MyCfg(object):
      __metaclass__ = Singleton
      def __init__(self, p1 = 1, p2 = 2):
          # Some code
  
  my_cfg = MyCfg()
  </code></pre>
  
  <p>However whenI run this code, I get a following error:</p>
  
  <pre><code>TypeError: MyCfg() takes exactly 1 argument (0 given)
  </code></pre>
  
  <p>I'm not new to <code>python</code> and programming but I never worked at with <code>python</code> at this level. I've been trying to understand what exactly happens in <code>Singleton</code> class but I can't figure out.</p>
  
  <p>Would anyone be able to explain why this code generates an error?  </p>