title: mypy: Correct way of type-annotating list of multiple types
body: <p>I have a list of lists that each contain a file object and a list of strings:</p>
  <pre><code>sample = [
      [fileobject1, ['hello', 'world']],
      [fileobject2, ['something', 'else']]
  ]
  </code></pre>
  <p>I type annotated <code>sample</code> like this:</p>
  <p><code>List[List[Union[IO, List[str]]]]</code></p>
  <p>Further in my code I call some methods on the first (0) and second (1) entry of the inner list.</p>
  <p>For example like this to clear the most inner list:</p>
  <p><code>entry[1].clear()</code></p>
  <p>The code runs fine, but mypy rightly complains that:</p>
  <p><code>Item &quot;IO[Any]&quot; of &quot;Union[IO[Any], List[str]]&quot; has no attribute &quot;clear&quot;</code></p>
  <p>How would I type-annotate this correctly? Maybe use a different data structure all together?</p>