title: mypy: How to "convert" variable length tuple back to fixed length tuple?
body: <p>Python code:</p>
  
  <pre><code>t = (1,2,3)
  t = tuple(x+1 for x in t)
  </code></pre>
  
  <p><a href="https://mypy.readthedocs.io/en/latest/kinds_of_types.html" rel="nofollow noreferrer">mypy</a> complains:</p>
  
  <pre><code>2: error: Incompatible types in assignment (expression has type "Tuple[int, ...]", variable has type "Tuple[int, int, int]")
  </code></pre>
  
  <p>What should I do to avoid that error? This does not help:</p>
  
  <pre><code>t = (1,2,3)
  t = tuple(x+1 for x in t)[0:3]
  </code></pre>
  
  <p>This "works":</p>
  
  <pre><code>from typing import Tuple
  t: Tuple[int, ...] = (1,2,3)
  t = tuple(x+1 for x in t)
  </code></pre>
  
  <p>But I actually don't want <code>t</code> to be a variable-length tuple.</p>
  
  <p>I can of course tell mypy to ignore the line:</p>
  
  <pre><code>t = (1,2,3)
  t = tuple(x+1 for x in t) # type: ignore
  </code></pre>
  
  <p>Or repeat myself:</p>
  
  <pre><code>t = (1,2,3)
  t = (t[0]+1, t[1]+1, t[2]+1)
  </code></pre>
  
  <p>Or use a temporary variable to at least avoid repeating the <code>+1</code> part (which is more complex in the real world problem):</p>
  
  <pre><code>t = (1,2,3)
  tmp = tuple(x+1 for x in t)
  t = (tmp[0], tmp[1], tmp[2])
  </code></pre>
  
  <p>Is there a better solution?</p>