title: Inherit List of Self, recursive definition
body: <p>I would like to build a recursive-type class, where the class is a list of things including itself. How can this be achieved? It doesn't seem to work even with <code>from __future__ import annotations</code>.</p>
  <pre><code>from __future__ import annotations
  from typing import Union, List
  
  class A:
      pass
  
  class AList(List[Union[A, AList]]):
      pass
  </code></pre>
  <p>The intent is the take advantage of various builtin methods of <code>list</code>, e.g. <code>append</code>, <code>extend</code>, <code>__iter__</code>, etc., while also be able to add custom methods.</p>
  <p>It's possible to simply subclass <code>list</code>. Is it adding anything to specify the types elements I will have in AList via <code>List[Union[A, AList]]</code>?</p>