<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: arange code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 23:32:05 GMT</pubDate>
    <description>DZone Snippets: arange code</description>
    <item>
      <title>A range function with float increment</title>
      <link>http://snippets.dzone.com/posts/show/1526</link>
      <description>Taken from Edvard Majakari's comment in this &lt;a href=http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66472&gt;recipe&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def arange(start, stop=None, step=None):&lt;br /&gt;    if stop is None:&lt;br /&gt;        stop = float(start)&lt;br /&gt;        start = 0.0&lt;br /&gt;    if step is None:&lt;br /&gt;        step = 1.0&lt;br /&gt;    cur = float(start)&lt;br /&gt;    while cur &lt; stop:&lt;br /&gt;        yield cur&lt;br /&gt;        cur += step&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;For python 2.2 (e.g. pys60) you need to do a "from __future__ import generators" first.&lt;br /&gt;To get the list from the generator, use list(arange(...))</description>
      <pubDate>Sat, 18 Feb 2006 20:45:03 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1526</guid>
      <author>korakot (Korakot Chaovavanich)</author>
    </item>
  </channel>
</rss>
