title: How can a subclass be created from a string passed to the superclass in python?
body: <p>Given a super class with two (or many) sub classes, for the sake of simplicity lets call them Super, Sub1 and Sub2 respectively.
  I would like to instantiate Sub1 and Sub2 as follows:</p>
  
  <pre><code>s1 = Super('Sub1')
  s2 = Super('Sub2')
  </code></pre>
  
  <p>i.e., passing the name of the sub classes as strings to the constructor of the super class.</p>
  
  <p>Something that came to mind was defining a class variable in Super with the names of the sub classes and with a couple of if statements in the constructor of the Super class the corresponding sub class constructor could be called.
  I'm not completely sure if that would work, but it just seems messy to me.
  Any suggestion on how to tackle this problem with a clean and pythonic approach is welcomed.</p>