title: Python inheritance: Create parent class object from child class
body: <p>I have a set of classes where a child is derived from a parent. 
  What I am trying to achieve is to create an object of the parent class that gets all its values from an object of the child class.
  The only way I found is this:</p>
  
  <pre class="lang-py prettyprint-override"><code>from copy import deepcopy
  class Parent(object):
      def __init__(self, value):
          self.val = value
  
  class Child(Parent):
      def __init__(self, val=8):
           super(Child, self).__init__(val)
           chval=5
  par=Parent(3)
  ch=Child()
  parent= Parent(4)
  parent.__dict__ = deepcopy(super(Child, ch).__dict__)
  print(parent.val)
  print(type(par), type(ch), type(parent))
  </code></pre>
  
  <p>The output is indeed</p>
  
  <pre><code>8
  (&lt;class '__main__.Parent'&gt;, &lt;class '__main__.Child'&gt;, &lt;class '__main__.Parent'&gt;)
  </code></pre>
  
  <p>but I am not sure whether this is a good, pythonesque and risk-free method of doing this</p>