<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>thinktoomuch.net &#187; Python</title>
	<atom:link href="http://www.thinktoomuch.net/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thinktoomuch.net</link>
	<description>Pondering the South African Memesphere - Looking for the Good in Everything</description>
	<lastBuildDate>Sun, 01 Jan 2012 00:11:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Tired of Old Religions</title>
		<link>http://www.thinktoomuch.net/2008/02/17/tired-of-old-religions/</link>
		<comments>http://www.thinktoomuch.net/2008/02/17/tired-of-old-religions/#comments</comments>
		<pubDate>Sun, 17 Feb 2008 19:44:12 +0000</pubDate>
		<dc:creator>thinker</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Frameworks]]></category>

		<guid isPermaLink="false">http://thinktoomuch.net/2008/02/17/tired-of-old-religions/</guid>
		<description><![CDATA[Here follows a relatively worthless blog post&#8230; just some arbitrary technical ponderings. I really should split this into a different blog. Blogs need to maintain focus. Probably better to take a short break than to mix in some irrelevant stuff? I&#8217;m currently growing a little tired and weary of this blog&#8217;s current discourse on religion. [...]]]></description>
			<content:encoded><![CDATA[<p><em>Here follows a relatively worthless blog post&#8230; just some arbitrary technical ponderings. I really should split this into a different blog. Blogs need to maintain focus. Probably better to take a short break than to mix in some irrelevant stuff?</em></p>
<p>I&#8217;m currently growing a little tired and weary of this blog&#8217;s current discourse on religion. (In part, the atheists do tire me. Or rather, I tire myself, by starting and climbing into debates I&#8217;m not really interested in. Somewhat of a pity, as I&#8217;m more interested in helping on the other side of the fence.) But anyway, maybe I should spend more time dabbling in <em>other</em> religions that my mind like so much&#8230;</p>
<p>Amongst others, the religions I currently practise include <a href="http://www.dina.kvl.dk/~abraham/religion/">Emacs</a>, <a href="http://www.python.org/">Python</a>, <a href="http://www.ubuntu.com/">Ubuntu</a> and <a href="http://wordpress.org/">WordPress</a>. I have neglected C++ and Java, but intend to return to pay my dues some time soon. At that point, the church of Emacs might ex-communicate me for dabbling in <a href="http://www.eclipse.org/">Eclipse</a>.  (The following are banished to the world of forgotten religions: Visual Basic 3 *gasp*, Turbo Pascal, and Delphi 3.)</p>
<p>Despite having mostly joined the Ubuntu camp, <a href="http://www.debian.org/">Debian</a> still receives some of my attention. DOS is dead, long live DOS. As much as I would like to forget Windows exists, peer pressure will be forcing me into attendance again all too soon.</p>
<p>While doing web app development, I have journeyed on the path of <a href="http://www.mems-exchange.org/software/quixote/">Quixote</a>, playing a little with <a href="http://www.sqlobject.org/">SQLObject</a>, but mostly sticking to pure <a href="http://www.initd.org/tracker/psycopg">psycopg</a>. Web.py has recently disappointed me, now I&#8217;m shifting my hopes for a better future to <a href="http://www.cherrypy.org/">CherryPy3</a> or possibly <a href="http://pythonpaste.org/">Paste</a>. Or on a higher level, <a href="http://turbogears.org/">TurboGears</a> (uses CherryPy3), <a href="http://pylonshq.com/">Pylons</a> (uses Paste) or <a href="http://www.djangoproject.com/">Django</a>. For another database back end option, there&#8217;s <a href="http://www.sqlalchemy.org/">SQLAlchemy</a>. Oi. It&#8217;s so tempting to just find some authority figure to listen to for all the answers, providing that ever elusive freedom from choice.</p>
<p>Lastly, I&#8217;m still drawing up plans for the church of mengelmoes. This may eventually sound a death knell for WordPress in my too-much-thinking corner of the web. I&#8217;m considering trying out <a href="http://www.mems-exchange.org/software/durus/">Durus</a> or <a href="http://www.zope.org/Products/StandaloneZODB">ZODB</a> as a backend.</p>
<p>Just two real priorities right now though: get decent authentication hacked into my current web app, and get video streaming working right.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thinktoomuch.net/2008/02/17/tired-of-old-religions/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A New Church?</title>
		<link>http://www.thinktoomuch.net/2007/11/04/a-new-church/</link>
		<comments>http://www.thinktoomuch.net/2007/11/04/a-new-church/#comments</comments>
		<pubDate>Sun, 04 Nov 2007 04:00:06 +0000</pubDate>
		<dc:creator>Who Knows?</dc:creator>
				<category><![CDATA[Religion and Science]]></category>
		<category><![CDATA[Website]]></category>
		<category><![CDATA[Church]]></category>
		<category><![CDATA[Mengelmoes]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://thinktoomuch.net/2007/11/04/a-new-church/</guid>
		<description><![CDATA[thinktoomuch.net is currently housed in a temporary building. In fact, all buildings are temporary, all buildings fade. Dust to dust. As I have the job of architect of this little homestead in the noosphere, I have been dreaming up a new architecture over the past few years. (The first pre-alpha prototype was developed in mid-2005. [...]]]></description>
			<content:encoded><![CDATA[<p>thinktoomuch.net is currently housed in a temporary building. In fact, all buildings are temporary, all buildings fade. Dust to dust.</p>
<p>As I have the job of <em>architect</em> of this little homestead in the noosphere, I have been dreaming up a new architecture over the past few years. (The first pre-alpha prototype was developed in mid-2005. That original prototype is hardly recognisable in the most recent incarnation of the plans.)</p>
<p><span id="more-128"></span></p>
<p>As this new architecture develops and evolves, a new building will be erected. Eventually we&#8217;ll move out of the current thinktoomuch.net building and into the new one. This can happen as soon as the new building is deemed &#8220;safe&#8221;, and has enough facilities to replace all the current facilities.</p>
<p>The raw material used in this architecture, at least initially, will be <a href="http://www.python.org/">Python</a>.</p>
<p>The new architecture will make many things possible. Once the first building is constructed on thinktoomuch.net, the dream includes having many satellite buildings, possibly connected by wormholes or a Floo Network, allowing near-instant travel between each of these buildings. We will ideally also have portkeys to other places that are not directly connected to the Floo Network.</p>
<p>Facebook is another building we are currently using for informal get-togethers. As soon as the new architecture is proven successful, we will hopefully be less dependent upon borrowing facilities belonging to other people. This is especially important to those that do not like hanging out in that particular neighbourhood.</p>
<p>The proposed name for the architecture used to be &#8220;PyMeliMelo&#8221;, named after the French &#8220;méli mélo&#8221;, which means something like &#8220;a complete jumbled mixture&#8230;&#8221;, e.g. &#8220;a méli mélo of ideas&#8221;, a complete mixed-up of ideas (thanks Maud). However, in its latest incarnation, the architecture will probably be called &#8220;Mengelmoes&#8221;, which is an Afrikaans word with similar meaning.</p>
<p>May this dream become a reality&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thinktoomuch.net/2007/11/04/a-new-church/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Python Call Graphs</title>
		<link>http://www.thinktoomuch.net/2007/06/06/python-call-graphs/</link>
		<comments>http://www.thinktoomuch.net/2007/06/06/python-call-graphs/#comments</comments>
		<pubDate>Wed, 06 Jun 2007 16:40:53 +0000</pubDate>
		<dc:creator>Who Knows?</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Website]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://thinktoomuch.net/2007/06/06/python-call-graphs/</guid>
		<description><![CDATA[Traditional blogging wisdom would say I should have more than one blog, to keep the subject matter more &#8220;focused&#8221;. Well, oops. What can I say. I&#8217;ll sort that out when my thesis is done. (Like the rest of my life. ) In the mean time, I&#8217;ll always feel some urge to not post more technical [...]]]></description>
			<content:encoded><![CDATA[<p>Traditional blogging wisdom would say I should have more than one blog, to keep the subject matter more &#8220;focused&#8221;. Well, oops. What can I say. I&#8217;ll sort that out when my thesis is done. (Like the rest of my life. <img src='http://www.thinktoomuch.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) In the mean time, I&#8217;ll always feel some urge to not post more technical stuff, like this. (Also, I suppose it doesn&#8217;t make sense to have this kind of post imported into Facebook &#8211; if you&#8217;re reading this in Facebook, would you prefer not to see &#8220;notes&#8221; like these?)</p>
<p>I found a cute call graph generator for python, <a href="http://pycallgraph.slowchop.com/">pycallgraph</a>. Despite still needing some attention (which it doesn&#8217;t seem to be getting?), it is usable, once you fix a <a href="http://pycallgraph.slowchop.com/pycallgraph/ticket/5">major defect</a> by adding a single line:<br />
<span id="more-61"></span><script type="text/javascript"><!--
google_ad_client = "pub-7678353532584189";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "336699";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
google_ui_features = "rc:0";
//-->
</script><br />
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<blockquote><pre>Index: pycallgraph.py
===================================================================
--- pycallgraph.py      (revision 23)
+++ pycallgraph.py      (working copy)
@@ -182,6 +182,7 @@
     if event == 'return':
         if call_stack:
             call_stack.pop(-1)
+    return tracer

 def get_dot(stop=True):
     """Returns a string containing a DOT file. Setting stop to True will cause</pre>
</blockquote>
<p>I&#8217;m not sure why this problem exists&#8230; this bug (and fix) has been known for quite some time? The actual graph is drawn with graphviz. There are some examples on the website, but of course, it&#8217;s most fun to run it on your own code that you know well. Usage (once fixed and installed) is as simple as adding four lines of code:</p>
<blockquote><pre>import pycallgraph
pycallgraph.start_trace()
...your code here...
pycallgraph.stop_trace()
pycallgraph.make_dot_graph('test.png')</pre>
</blockquote>
<p>This will use &#8220;dot&#8221;. You can use other graphviz binaries and adjust the output format:</p>
<blockquote><pre>pycallgraph.make_dot_graph('test.jpg', format='jpg', tool='neato')</pre>
</blockquote>
<p>I&#8217;m not sure what the best way would be to collect a trace over all your unit tests. I placed <code>start_trace(reset=False)</code> and <code>stop_trace()</code> in each test (placing them in setUp() and tearDown() would require filtering out the testing framework if I want a clean graph, and I&#8217;m a little lazy to use pycallgraph&#8217;s exclusion mechanism right now). Then I subclassed unittest.TextTestRunner to include <code>make_dot_graph(...)</code> as follows:</p>
<blockquote><pre>class CallGraphTextTestRunner(TextTestRunner):
    def __init__(self, callgraph_filename, *args, **kwargs):
        TextTestRunner.__init__(self, *args, **kwargs)
        self._callgraph_filename = callgraph_filename

    def run(self, test):
        result = TextTestRunner.run(self, test)
        pycallgraph.make_dot_graph(self._callgraph_filename)
        return result

main(testRunner=CallGraphTextTestRunner('test_callgraph.png'))</pre>
</blockquote>
<p>What an unimaginative class name. Any better suggestions?</p>
<p>(If you are new to unit testing in Python, you might need to look at more than <a href="http://docs.python.org/lib/minimal-example.html">just a basic example</a> of unit testing in Python.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thinktoomuch.net/2007/06/06/python-call-graphs/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

