title: Is there a nicer idiom for "repeat N times" than "for _" in Python?
body: <p>My question is quite simple; is there a nicer way to repeat a block of code</p>
  
  <pre><code>for _ in range(N):
      stuff = 10
      thing = True
      a_task(stuff, thing)
      ...
  </code></pre>
  
  <p>or to create a list of N objects of the same class like <code>a_list = [AnObject() for _ in range(N)]</code> but without ugly <code>for _ in range(N)</code>? </p>
  
  <hr>
  
  <p>Something like </p>
  
  <pre><code>with repeat(50):
      ...
  </code></pre>
  
  <p>would be nice for the block case but I guess it's not possible to achieve it with context managers. </p>
  
  <p>Also note that <code>a_list = [AnObject()] * N</code> is not an answer for the second case since it copies references.</p>
  
  <hr>
  
  <p>Any nice alternative for the ugly <code>for _</code> in both cases?</p>