title: Range with step of type float
body: <p><a href="http://docs.python.org/library/functions.html#range" rel="noreferrer">The documentation</a> basically says that <code>range</code> must behave exactly as this implementation (for positive <code>step</code>):</p>
  
  <pre><code>def range(start, stop, step):
    x = start
    while True:
      if x &gt;= stop: return
      yield x
      x += step
  </code></pre>
  
  <p>It also says that its arguments must be integers. Why is that? Isn't that definition also perfectly valid if step is a float?</p>
  
  <p>In my case, I am esp. needing a <code>range</code> function which accepts a float type as its <code>step</code> argument. Is there any in Python or do I need to implement my own?</p>
  
  <hr>
  
  <p>More specific: How would I translate this C code directly to Python in a nice way (i.e. not just doing it via a <code>while</code>-loop manually):</p>
  
  <pre><code>for(float x = 0; x &lt; 10; x += 0.5f) { /* ... */ }
  </code></pre>