title: Reinstanciating a class inside the class in Python?
body: <p>For example, if I have the class:</p>
  
  <pre class="lang-py prettyprint-override"><code>class Foo:
      def __init__(self, bar):
          self.bar = bar
          self.baz = self.bar + "foo"
  
      def restart(self, value):
          # reinstanciate the class with new value (bar) function ???
  </code></pre>
  
  <p>How can I get this functionality so that the class can be reinstanciated but stay in the same instance (<code>ex</code>)?</p>
  
  <pre class="lang-py prettyprint-override"><code>ex = Foo("baz")
  print(ex.bar)
  # "baz"
  print(ex.baz)
  # "bazfoo"
  
  ex.restart("qux")
  print(ex.bar)
  # "qux"
  print(ex.baz)
  # "quxfoo"
  </code></pre>