<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>A River of Words - Python</title>
    <link>http://blog.joeysmith.com/</link>
    <description>Drowning In Stupid</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.4.1 - http://www.s9y.org/</generator>
    <pubDate>Tue, 14 Oct 2008 05:10:15 GMT</pubDate>

    <image>
        <url>http://blog.joeysmith.com/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: A River of Words - Python - Drowning In Stupid</title>
        <link>http://blog.joeysmith.com/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Project Euler, Problem #2 in Python</title>
    <link>http://blog.joeysmith.com/35.html</link>
            <category>Python</category>
    
    <comments>http://blog.joeysmith.com/35.html#comments</comments>
    <wfw:comment>http://blog.joeysmith.com/wfwcomment.php?cid=35</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.joeysmith.com/rss.php?version=2.0&amp;type=comments&amp;cid=35</wfw:commentRss>
    

    <author>nospam@example.com (TML)</author>
    <content:encoded>
    	&lt;p&gt;As a &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/codekata.pragprog.com/&#039;);&quot;  href=&quot;http://codekata.pragprog.com/&quot;&gt;Code Kata&lt;/a&gt;, I&amp;#8217;ve been working my way through the &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/projecteuler.net/index.php?section=problems&#039;);&quot;  href=&quot;http://projecteuler.net/index.php?section=problems&quot;&gt;Project Euler&lt;/a&gt; stuff.&lt;/p&gt;

	&lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/projecteuler.net/index.php?section=problems&amp;amp;#38;id=2&#039;);&quot;  href=&quot;http://projecteuler.net/index.php?section=problems&amp;#38;id=2&quot;&gt;Here&amp;#8217;s&lt;/a&gt; the problem.&lt;/p&gt;

	&lt;p&gt;Here&amp;#8217;s my solution:&lt;/p&gt;

	&lt;p&gt;&lt;pre style=&quot;font-size:9pt;&quot;&gt;&lt;/p&gt;

	&lt;p&gt;&lt;span style=&quot;color:#ac2020; font-style:italic&quot;&gt;# A generator to derive the Fibonacci sequence&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#9c20ee; font-weight:bold&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;fib&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;():&lt;/span&gt;
    x&lt;span style=&quot;color:#000000&quot;&gt;,&lt;/span&gt; y &lt;span style=&quot;color:#000000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;1&lt;/span&gt;
    &lt;span style=&quot;color:#9c20ee; font-weight:bold&quot;&gt;yield&lt;/span&gt; x
    &lt;span style=&quot;color:#9c20ee; font-weight:bold&quot;&gt;yield&lt;/span&gt; y
    &lt;span style=&quot;color:#9c20ee; font-weight:bold&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;:&lt;/span&gt;
        x&lt;span style=&quot;color:#000000&quot;&gt;,&lt;/span&gt; y &lt;span style=&quot;color:#000000&quot;&gt;=&lt;/span&gt; y&lt;span style=&quot;color:#000000&quot;&gt;,&lt;/span&gt; x&lt;span style=&quot;color:#000000&quot;&gt;+&lt;/span&gt;y
        &lt;span style=&quot;color:#9c20ee; font-weight:bold&quot;&gt;yield&lt;/span&gt; y&lt;/p&gt;

	&lt;p&gt;&lt;span style=&quot;color:#9c20ee; font-weight:bold&quot;&gt;if&lt;/span&gt; &lt;i&gt;name&lt;/i&gt; &lt;span style=&quot;color:#000000&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color:#bd8d8b&quot;&gt;&amp;#8216;&lt;i&gt;main&lt;/i&gt;&amp;#8216;&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;:&lt;/span&gt;
    idx &lt;span style=&quot;color:#000000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;0&lt;/span&gt;
    &lt;span style=&quot;color:#208920&quot;&gt;sum&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;0&lt;/span&gt;
    gen &lt;span style=&quot;color:#000000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;fib&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;()&lt;/span&gt;&lt;/p&gt;

    &lt;span style=&quot;color:#9c20ee; font-weight:bold&quot;&gt;while&lt;/span&gt; idx &lt;span style=&quot;color:#000000&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;4000000&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;:&lt;/span&gt;
        idx &lt;span style=&quot;color:#000000&quot;&gt;=&lt;/span&gt; gen&lt;span style=&quot;color:#000000&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;()&lt;/span&gt;
        &lt;span style=&quot;color:#9c20ee; font-weight:bold&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;(&lt;/span&gt;g &lt;span style=&quot;color:#000000&quot;&gt;%&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color:#000000&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color:#000000&quot;&gt;):&lt;/span&gt; h &lt;span style=&quot;color:#000000&quot;&gt;=&lt;/span&gt; h&lt;span style=&quot;color:#000000&quot;&gt;+&lt;/span&gt;g
    &lt;span style=&quot;color:#9c20ee; font-weight:bold&quot;&gt;print&lt;/span&gt; h
&lt;/pre&gt;

	&lt;p&gt;Note: You want to be careful how you use infinite generators like the &amp;#8216;fib()&amp;#8217; I created above.&lt;/p&gt;

	&lt;p&gt;One guy on the forums noted:&lt;/p&gt;

	&lt;blockquote&gt;
		&lt;p&gt;Now, replacing an odd number with O and an even with E, we get: O, O, E, O, O, E, O, O, E, O, O, E, O, O, E&amp;#8230;And so each third number is even. We don&amp;#8217;t need to calculate the odd numbers. Starting from an two odd terms x, y, the series is: x, y, x + y, x + 2y, 2x + 3y, 3x + 5y&lt;/p&gt;
	&lt;/blockquote&gt; 
    </content:encoded>

    <pubDate>Tue, 14 Oct 2008 02:10:00 -0600</pubDate>
    <guid isPermaLink="false">http://blog.joeysmith.com/35.html</guid>
    
</item>
<item>
    <title>Pylons References</title>
    <link>http://blog.joeysmith.com/19.html</link>
            <category>Python</category>
    
    <comments>http://blog.joeysmith.com/19.html#comments</comments>
    <wfw:comment>http://blog.joeysmith.com/wfwcomment.php?cid=19</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.joeysmith.com/rss.php?version=2.0&amp;type=comments&amp;cid=19</wfw:commentRss>
    

    <author>nospam@example.com (TML)</author>
    <content:encoded>
    	&lt;p&gt;Spent the day poking at &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/pylonshq.com/&#039;);&quot;  href=&quot;http://pylonshq.com/&quot;&gt;Pylons 0.9.7rc2&lt;/a&gt; as well as the new documentation site that came out with the release of &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/python.org/download/releases/2.6/&#039;);&quot;  href=&quot;http://python.org/download/releases/2.6/&quot;&gt;Python 2.6&lt;/a&gt; &amp;#8211; some sweet stuff in there.&lt;/p&gt;

	&lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/pythonpaste.org/webob/&#039;);&quot;  href=&quot;http://pythonpaste.org/webob/&quot;&gt;WebOb: The New Middleware Layer on 0.9.7&lt;/a&gt;, its &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/pythonpaste.org/webob/reference.html&#039;);&quot;  href=&quot;http://pythonpaste.org/webob/reference.html&quot;&gt;Reference page&lt;/a&gt;, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/pythonpaste.org/webob/differences.html&#039;);&quot;  href=&quot;http://pythonpaste.org/webob/differences.html&quot;&gt;How WebOb is different&lt;/a&gt; and &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/blog.ianbicking.org/2007/08/18/webob/&#039;);&quot;  href=&quot;http://blog.ianbicking.org/2007/08/18/webob/&quot;&gt;Ian Bicking&amp;#8217;s Blog Post about it&lt;/a&gt; &amp;#8211; &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/blog.ianbicking.org&#039;);&quot;  href=&quot;http://blog.ianbicking.org&quot;&gt;Ian&lt;/a&gt; is one of those guys who is so smart it fills me with a jealous rage. I&amp;#8217;ve already found a lot of useful stuff in WebOb that was missing or hard to do with the older Pylons middleware.&lt;/p&gt;

	&lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/wiki.pylonshq.com/dashboard.action&#039;);&quot;  href=&quot;http://wiki.pylonshq.com/dashboard.action&quot;&gt;Base Pylons Documentation&lt;/a&gt;, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/wiki.pylonshq.com/display/authkitcookbook/Home&#039;);&quot;  href=&quot;http://wiki.pylonshq.com/display/authkitcookbook/Home&quot;&gt;AuthKit Cookbook&lt;/a&gt;, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/wiki.pylonshq.com/display/pylonscommunity/Pylons+Roadmap+to+1.0&#039;);&quot;  href=&quot;http://wiki.pylonshq.com/display/pylonscommunity/Pylons+Roadmap+to+1.0&quot;&gt;Roadmap to Pylons 1.0&lt;/a&gt; &amp;#8211; just some good links to pylonshq&lt;/p&gt;

	&lt;p&gt;Python modules I need to brush up on, or just links I used in the course of today&amp;#8217;s work: &lt;br /&gt;
&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/docs.python.org/modindex.html&#039;);&quot;  href=&quot;http://docs.python.org/modindex.html&quot;&gt;2.6 Documentation Index&lt;/a&gt;, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/docs.python.org/library/shutil.html&#039;);&quot;  href=&quot;http://docs.python.org/library/shutil.html&quot;&gt;shutil&lt;/a&gt;, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/docs.python.org/library/xdrlib.html&#039;);&quot;  href=&quot;http://docs.python.org/library/xdrlib.html&quot;&gt;xdrlib&lt;/a&gt;, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/docs.python.org/library/functools.html&#039;);&quot;  href=&quot;http://docs.python.org/library/functools.html&quot;&gt;functools &amp;#8211; a lot of functional paradigm stuff moved here?&lt;/a&gt;, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/docs.python.org/library/stringio.html&#039;);&quot;  href=&quot;http://docs.python.org/library/stringio.html&quot;&gt;StringIO&lt;/a&gt;, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/docs.python.org/library/tempfile.html&#039;);&quot;  href=&quot;http://docs.python.org/library/tempfile.html&quot;&gt;tempfile &amp;#8211; probably the best tempfile implementation by a programming language, ever&lt;/a&gt;, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/simplejson.googlecode.com/svn/tags/simplejson-2.0.1/docs/index.html&#039;);&quot;  href=&quot;http://simplejson.googlecode.com/svn/tags/simplejson-2.0.1/docs/index.html&quot;&gt;simpleJSON revved to 2.0.1&lt;/a&gt;, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/docs.python.org/library/index.html&#039;);&quot;  href=&quot;http://docs.python.org/library/index.html&quot;&gt;2.6 &amp;#8216;Standard Library&amp;#8217; Index&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.makotemplates.org/docs/&#039;);&quot;  href=&quot;http://www.makotemplates.org/docs/&quot;&gt;Mako&lt;/a&gt; &amp;#8211; I&amp;#8217;m not sure why there are so dang many Pythons template layers. In fact, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.reportlab.org/preppy.html&#039;);&quot;  href=&quot;http://www.reportlab.org/preppy.html&quot;&gt;Preppy&lt;/a&gt; is another one that I might use more in the future due to its integration with &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.reportlab.org/&#039;);&quot;  href=&quot;http://www.reportlab.org/&quot;&gt;ReportLab&amp;#8217;s &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; Toolkit&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/pylonsbook.com/alpha1/logging&#039;);&quot;  href=&quot;http://pylonsbook.com/alpha1/logging&quot;&gt;The Pylons Book&lt;/a&gt; &amp;#8211; I&amp;#8217;ve already pre-purchased, but wish it had more &amp;#8220;nuts and bolts&amp;#8221; based on what I&amp;#8217;ve seen so far.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 02 Oct 2008 15:02:05 -0600</pubDate>
    <guid isPermaLink="false">http://blog.joeysmith.com/19.html</guid>
    
</item>

</channel>
</rss>