title: Python how to define type hint for union of all subclasses
body: <p>Let's say I have a class that have multiple subclasses in a recursive/tree hierarchy:</p>
  <pre class="lang-py prettyprint-override"><code>class Animal:
      pass
  class Cat(Animal):
      pass
  class HouseCat(Cat):
      pass
  </code></pre>
  <p>And I have a function, that can create instances of these classes based on some condition:</p>
  <pre class="lang-py prettyprint-override"><code>from typing import Union
  def creator(condition) -&gt; Union[Animal, Cat, HouseCat]:
      # for codition1
      return Animal()
      # for codition2
      return Cat()
      # ...etc...
  </code></pre>
  <p>My problem is that PyCharm shows a warning for something like this, if I only use <code>-&gt; Animal:</code> as return value annotation:</p>
  <pre class="lang-py prettyprint-override"><code>my_list: List[Cat] = []
  obj = creator(...)
  my_list.append(obj)  # &lt;-- Expected type 'Cat' (matched generic type '_T'), got 'Animal' instead
  </code></pre>
  <p>Is there a way to define a type hint instead of manually writing a <code>Union</code> for all subclasses?</p>