title: Python: How to call an instance method from a class method of the same class
body: <p>I have a class as follows:</p>
  
  <pre><code>class MyClass(object):
      int = None
      def __init__(self, *args, **kwargs):
          for k, v in kwargs.iteritems():
              setattr(self, k, v)
  
      def get_params(self):
          return {'int': random.randint(0, 10)}
  
      @classmethod
      def new(cls):
          params = cls.get_params()
          return cls(**params)
  </code></pre>
  
  <p>and I would like to be able to do:</p>
  
  <pre><code>&gt;&gt;&gt; obj = MyClass.new()
  &gt;&gt;&gt; obj.int  # must be defined
  9
  </code></pre>
  
  <p>I mean without creating a new instance of <code>MyClass</code>, but obviously it's not that simple, because calling <code>MyClass.new()</code> throws <code>TypeError: unbound method get_params() must be called with MyClass instance as first argument (got nothing instead)</code></p>
  
  <p>Is there any way to accomplish so?
  Thanks</p>