title: While loop with enumeration in Python
body: <p>I sometimes have this:</p>
  <pre><code>i = 0
  while condition:
      ...
      i += 1
  </code></pre>
  <p>Here is an example situation: <a href="https://stackoverflow.com/questions/13852700/create-file-but-if-name-exists-add-number/61561245#61561245">Create file but if name exists add number</a>.</p>
  <p>I don't know any option to do another way (except those discussed in <a href="https://stackoverflow.com/questions/29576733/using-enumerate-function-in-while-loops">Using enumerate function in while loops</a>), but usually Python always has some syntactic sugar to avoid the manual &quot;<code>i = 0, ..., i += 1</code> pattern&quot;.</p>
  <p>Is there an alternative in newest versions of Python? Something like (pseudo-code):</p>
  <pre><code>for i in enumerate(while(condition)):
      ...
  </code></pre>