<?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>Shey's Rebellion &#187; Python</title>
	<atom:link href="http://www.sheysrebellion.net/blog/category/programming/python-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sheysrebellion.net/blog</link>
	<description>I sleep with pillows on my head.</description>
	<lastBuildDate>Thu, 27 Jan 2011 18:59:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Introducing Cushion, a simple python wrapper for CouchDB</title>
		<link>http://www.sheysrebellion.net/blog/2011/01/27/introducing-cushion-a-simple-python-wrapper-for-couchdb/</link>
		<comments>http://www.sheysrebellion.net/blog/2011/01/27/introducing-cushion-a-simple-python-wrapper-for-couchdb/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 07:16:31 +0000</pubDate>
		<dc:creator>Sheheryar Sewani</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sheysrebellion.net/blog/?p=420</guid>
		<description><![CDATA[Introducing Cushion, a very thin python wrapper around CouchDB&#8217;s Document API. Its interface closely mimics REST and it was created primarily as an exercise to learn CouchDB&#8217;s API. Cushion is not an object mapper, it doesn’t enforce ‘OOP’, and if you found it difficult to get started with CouchDB using other libraries then you might [...]]]></description>
			<content:encoded><![CDATA[<p>Introducing <a href="http://pypi.python.org/pypi/cushion/0.2">Cushion</a>, a very thin python wrapper around CouchDB&#8217;s Document API. Its interface closely mimics REST and it was created primarily as an exercise to learn CouchDB&#8217;s API. Cushion is not an object mapper, it doesn’t enforce ‘OOP’, and if you found it difficult to get started with CouchDB using other libraries then you might be interested in Cushion.</p>
<p>To retrieve a document using Cushion:</p>
<p><script src="https://gist.github.com/798184.js?file=get.py"></script></p>
<p>To create a document with a document id using Cushion:</p>
<p><script src="https://gist.github.com/798186.js?file=put.py"></script></p>
<p>To install Cushion:  <code>easy_install cushion</code>.  If you&#8217;re interested, the source code and more documentation is available on GitHub: <a href="https://github.com/sheysrebellion/cushion">git://github.com/sheysrebellion/cushion.git</a></p>
<p>Relax, enjoy.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2011%2F01%2F27%2Fintroducing-cushion-a-simple-python-wrapper-for-couchdb%2F&amp;title=Introducing%20Cushion%2C%20a%20simple%20python%20wrapper%20for%20CouchDB" title="del.icio.us"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2011%2F01%2F27%2Fintroducing-cushion-a-simple-python-wrapper-for-couchdb%2F&amp;title=Introducing%20Cushion%2C%20a%20simple%20python%20wrapper%20for%20CouchDB" title="Reddit"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2011%2F01%2F27%2Fintroducing-cushion-a-simple-python-wrapper-for-couchdb%2F&amp;t=Introducing%20Cushion%2C%20a%20simple%20python%20wrapper%20for%20CouchDB" title="Facebook"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2011%2F01%2F27%2Fintroducing-cushion-a-simple-python-wrapper-for-couchdb%2F" title="Identi.ca"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2011%2F01%2F27%2Fintroducing-cushion-a-simple-python-wrapper-for-couchdb%2F" title="TwitThis"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sheysrebellion.net/blog/2011/01/27/introducing-cushion-a-simple-python-wrapper-for-couchdb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dispatch Tables:  The forgotten design pattern</title>
		<link>http://www.sheysrebellion.net/blog/2011/01/23/dispatch-tables-the-forgotten-design-pattern/</link>
		<comments>http://www.sheysrebellion.net/blog/2011/01/23/dispatch-tables-the-forgotten-design-pattern/#comments</comments>
		<pubDate>Sun, 23 Jan 2011 22:12:51 +0000</pubDate>
		<dc:creator>Sheheryar Sewani</dc:creator>
				<category><![CDATA[Development and Design]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sheysrebellion.net/blog/?p=413</guid>
		<description><![CDATA[Long if-else statements and tall case statements are scary. As the number of lines and conditional branches grow, the more difficult it becomes to fit the program&#8217;s logic inside your head and the more likely you are to introduce bugs into the code. We rely on polymorphism and design patterns to help reduce complexity; often [...]]]></description>
			<content:encoded><![CDATA[<p>Long if-else statements and tall case statements are scary. As the number of lines and conditional branches grow, the more difficult it becomes to fit the program&#8217;s logic inside your head and the more likely you are to introduce bugs into the code.</p>
<p>We rely on polymorphism and design patterns to help reduce complexity; often those solutions are well suited for static programming languages like Java, but feel ceremonious in languages like Python and Javascript.  If you&#8217;re programming in a dynamic programming language that supports dictionaries out of the box, then you may find the Dispatch Table &#8220;pattern&#8221; a useful way to simply your code.</p>
<p>The pattern uses a dictionary where the keys represent possible actions, and the value of each key contains a callable that does the actual work. Compared to if-else statements, dispatch tables require fewer lines of code, and we know fewer lines of code equals fewer bugs.</p>
<p>Here&#8217;s a mostly real world example that creates handlers for webhooks.  You can imagine how long the if-else statement, that is used to decide which handler to instantiate, can become, especially when the consuming code has to respond to multiple keys.</p>
<p><script src="https://gist.github.com/792485.js?file=dispatch.py"></script></p>
<p>Neat.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2011%2F01%2F23%2Fdispatch-tables-the-forgotten-design-pattern%2F&amp;title=Dispatch%20Tables%3A%20%20The%20forgotten%20design%20pattern" title="del.icio.us"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2011%2F01%2F23%2Fdispatch-tables-the-forgotten-design-pattern%2F&amp;title=Dispatch%20Tables%3A%20%20The%20forgotten%20design%20pattern" title="Reddit"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2011%2F01%2F23%2Fdispatch-tables-the-forgotten-design-pattern%2F&amp;t=Dispatch%20Tables%3A%20%20The%20forgotten%20design%20pattern" title="Facebook"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2011%2F01%2F23%2Fdispatch-tables-the-forgotten-design-pattern%2F" title="Identi.ca"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2011%2F01%2F23%2Fdispatch-tables-the-forgotten-design-pattern%2F" title="TwitThis"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sheysrebellion.net/blog/2011/01/23/dispatch-tables-the-forgotten-design-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Experimenting with partial application in Python</title>
		<link>http://www.sheysrebellion.net/blog/2010/12/06/experimenting-with-partial-application-in-python/</link>
		<comments>http://www.sheysrebellion.net/blog/2010/12/06/experimenting-with-partial-application-in-python/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 00:05:48 +0000</pubDate>
		<dc:creator>Sheheryar Sewani</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.sheysrebellion.net/blog/?p=407</guid>
		<description><![CDATA[In a recent project, I&#8217;ve experimented with &#8220;partial()&#8221; to simplify object creation. Partially applying a function, similar to currying, is a technique in which a new function is synthesized by pre-filling the arguments to an existing function. Python&#8217;s implementation of partial is available in two separate modules: functools and functional. It&#8217;s best understood with an [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent project, I&#8217;ve experimented with &#8220;partial()&#8221; to simplify object creation. Partially applying a function, similar to currying, is a technique in which a new function is synthesized by pre-filling the arguments to an existing function.  Python&#8217;s implementation of partial is available in two separate modules: functools and functional.  It&#8217;s best understood with an example, albeit contrived:</p>
<p><script src="https://gist.github.com/731212.js?file=OOPy.py"></script></p>
<p><script src="https://gist.github.com/731213.js?file=partial.py"></script></p>
<p>Instead of defining a factory class and a creation method on that class, I define creation function which accepts the dependencies as parameters, partially apply them and use the new function as my &#8220;creation function.&#8221;  I prefer the second example, I enjoyed writing it, but both examples perform the same function with essentially the same number of lines and ultimately my preference is as basic as preferring a functional style of programming over object oriented.</p>
<p>So I&#8217;m wondering, how do other developers use currying or partial application in their projects?</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F12%2F06%2Fexperimenting-with-partial-application-in-python%2F&amp;title=Experimenting%20with%20partial%20application%20in%20Python" title="del.icio.us"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F12%2F06%2Fexperimenting-with-partial-application-in-python%2F&amp;title=Experimenting%20with%20partial%20application%20in%20Python" title="Reddit"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F12%2F06%2Fexperimenting-with-partial-application-in-python%2F&amp;t=Experimenting%20with%20partial%20application%20in%20Python" title="Facebook"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F12%2F06%2Fexperimenting-with-partial-application-in-python%2F" title="Identi.ca"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F12%2F06%2Fexperimenting-with-partial-application-in-python%2F" title="TwitThis"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sheysrebellion.net/blog/2010/12/06/experimenting-with-partial-application-in-python/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Consuming AMQP messages with Python and Sparkplug</title>
		<link>http://www.sheysrebellion.net/blog/2010/08/22/consuming-amqp-messages-with-python-and-sparkplug/</link>
		<comments>http://www.sheysrebellion.net/blog/2010/08/22/consuming-amqp-messages-with-python-and-sparkplug/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 22:24:33 +0000</pubDate>
		<dc:creator>Sheheryar Sewani</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[AMQP]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[RabbitMQ]]></category>

		<guid isPermaLink="false">http://www.sheysrebellion.net/blog/?p=401</guid>
		<description><![CDATA[Consuming AMQP/RabbitMQ messages in Python is simple if you use Sparkplug. I read &#8220;Building RabbitMQ apps using Python&#8220;, and there&#8217;s just too much code in the monitor method and the separation of concerns aren&#8217;t very clear. With Sparkplug, you create a configuration file, then define Consumer class to handle each message. As messages are pushed [...]]]></description>
			<content:encoded><![CDATA[<p>Consuming AMQP/RabbitMQ messages in Python is simple if you use Sparkplug.  I read &#8220;<a href="http://blog.springsource.com/2010/08/19/building-rabbitmq-apps-using-python/">Building RabbitMQ apps using Python</a>&#8220;, and there&#8217;s just too much code in the monitor method and the separation of concerns aren&#8217;t very clear. </p>
<p>With <a href="http://pypi.python.org/pypi/sparkplug/1.0.2">Sparkplug</a>, you create a configuration file, then define Consumer class to handle each message.  As messages are pushed into the queue, Sparkplug will call your class and you decide how you want handle the message in the __call__ method.  The great thing about this is that all the connection logic is removed from your code letting you concentrate on how you want to handle each message. </p>
<p><script src="http://gist.github.com/544350.js?file=consumer.py"></script></p>
<p>Now you can run your app using <code>sparkplug --daemon consumer.ini</code>.  Configuration is boring, so I&#8217;ve left the <a href="http://gist.github.com/544350#file_consumer.ini">consumer.ini</a> out of the blog post and put it up on github instead.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F08%2F22%2Fconsuming-amqp-messages-with-python-and-sparkplug%2F&amp;title=Consuming%20AMQP%20messages%20with%20Python%20and%20Sparkplug" title="del.icio.us"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F08%2F22%2Fconsuming-amqp-messages-with-python-and-sparkplug%2F&amp;title=Consuming%20AMQP%20messages%20with%20Python%20and%20Sparkplug" title="Reddit"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F08%2F22%2Fconsuming-amqp-messages-with-python-and-sparkplug%2F&amp;t=Consuming%20AMQP%20messages%20with%20Python%20and%20Sparkplug" title="Facebook"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F08%2F22%2Fconsuming-amqp-messages-with-python-and-sparkplug%2F" title="Identi.ca"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F08%2F22%2Fconsuming-amqp-messages-with-python-and-sparkplug%2F" title="TwitThis"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sheysrebellion.net/blog/2010/08/22/consuming-amqp-messages-with-python-and-sparkplug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple, Expressive Builders in Python</title>
		<link>http://www.sheysrebellion.net/blog/2010/08/09/simple-expressive-builders-in-python/</link>
		<comments>http://www.sheysrebellion.net/blog/2010/08/09/simple-expressive-builders-in-python/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 02:46:32 +0000</pubDate>
		<dc:creator>Sheheryar Sewani</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.sheysrebellion.net/blog/?p=397</guid>
		<description><![CDATA[Jesse has written a great blog post on using test builders to improve the expressiveness of unit tests. He has convinced me that builders are useful and that they provide an easy way to construct objects that are in a valid state. Testing can be hard; I find defining a method for each of the [...]]]></description>
			<content:encoded><![CDATA[<p>Jesse has written a great blog post on using <a href="http://jessejoelmiller.com/2010/07/builders-in-python/">test builders to improve the expressiveness of unit tests</a>. He has convinced me that builders are useful and that they provide an easy way to construct objects that are in a valid state. Testing can be hard; I find defining a method for each of the object&#8217;s properties to be tedious and repetitive.  This is especially problematic if you&#8217;re working with an object with dozens of properties.</p>
<p>To balance expressive with conciseness, I&#8217;ve refactored the builder to use Python dictionaries<br />
<script src="http://gist.github.com/516560.js?file=builders.py"></script><br />
<script src="http://gist.github.com/516560.js?file=test-banker.py"></script></p>
<p>I find this code to be just as expressive, easier to use and most importantly not repetitive.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F08%2F09%2Fsimple-expressive-builders-in-python%2F&amp;title=Simple%2C%20Expressive%20Builders%20in%20Python" title="del.icio.us"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F08%2F09%2Fsimple-expressive-builders-in-python%2F&amp;title=Simple%2C%20Expressive%20Builders%20in%20Python" title="Reddit"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F08%2F09%2Fsimple-expressive-builders-in-python%2F&amp;t=Simple%2C%20Expressive%20Builders%20in%20Python" title="Facebook"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F08%2F09%2Fsimple-expressive-builders-in-python%2F" title="Identi.ca"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2010%2F08%2F09%2Fsimple-expressive-builders-in-python%2F" title="TwitThis"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sheysrebellion.net/blog/2010/08/09/simple-expressive-builders-in-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Inversion of Control in Python</title>
		<link>http://www.sheysrebellion.net/blog/2009/08/24/inversion-of-control-in-python/</link>
		<comments>http://www.sheysrebellion.net/blog/2009/08/24/inversion-of-control-in-python/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 17:33:00 +0000</pubDate>
		<dc:creator>Sheheryar Sewani</dc:creator>
				<category><![CDATA[Development and Design]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[IoC]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.sheysrebellion.net/blog/2009/08/24/inversion-of-control-in-python/</guid>
		<description><![CDATA[Coming from a .NET background and having applied SOLID principles to software development, I was surprised by the lack of inversion of control containers for Python. The few discussions I read online implied that Python doesn’t need an IoC framework because it is a dynamically typed language.  Dynamically typed languages eliminate the need to use [...]]]></description>
			<content:encoded><![CDATA[<p>Coming from a .NET background and having applied <a href="http://www.lostechies.com/blogs/chad_myers/archive/2008/03/07/pablo-s-topic-of-the-month-march-solid-principles.aspx">SOLID principles</a> to software development, I was surprised by the lack of <a href="http://www.martinfowler.com/articles/injection.html">inversion of control containers</a> for Python.</p>
<p>The few discussions I read online implied that Python doesn’t need an IoC framework because it is a dynamically typed language.  Dynamically typed languages eliminate the need to use interfaces, they do not do away with the need for inversion of control.</p>
<p>IoC is used to decouple components of an application, remove direct dependencies so that replacing a component will not have a side effects on the rest of the system.  As <a href="http://pragdave.blogs.pragprog.com/pragdave/2004/11/transparent_inv.html">Dave Thomas explains</a></p>
<blockquote><p>a DI application is written as a set of loosely coupled components. These components contain no knitting code: nothing in the application code itself is responsible, for example, for making sure that the necessary objects somehow get an instance of the database connection. Instead, the components all run in a container. This container is given a description of the knitting to be done (typically using an XML file). The container then instantiates objects and sets them into components that need them</p></blockquote>
<p>I’m new to the language and there maybe a more “pythonic” way to handle inversion of control than using a container. Here is small and contrived example of inversion of control using <a href="http://code.google.com/p/pinsor/">Pinsor, a IoC container in Python</a>. Those coming from a .NET or Java background will find Pinsor easy to use, but slightly lacking in features.</p>
<script src="http://gist.github.com/172997.js"></script>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2009%2F08%2F24%2Finversion-of-control-in-python%2F&amp;title=Inversion%20of%20Control%20in%20Python" title="del.icio.us"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2009%2F08%2F24%2Finversion-of-control-in-python%2F&amp;title=Inversion%20of%20Control%20in%20Python" title="Reddit"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2009%2F08%2F24%2Finversion-of-control-in-python%2F&amp;t=Inversion%20of%20Control%20in%20Python" title="Facebook"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2009%2F08%2F24%2Finversion-of-control-in-python%2F" title="Identi.ca"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2009%2F08%2F24%2Finversion-of-control-in-python%2F" title="TwitThis"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sheysrebellion.net/blog/2009/08/24/inversion-of-control-in-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Change point analysis in Python</title>
		<link>http://www.sheysrebellion.net/blog/2009/08/19/change-point-analysis-in-python/</link>
		<comments>http://www.sheysrebellion.net/blog/2009/08/19/change-point-analysis-in-python/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 02:31:12 +0000</pubDate>
		<dc:creator>Sheheryar Sewani</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[changepoint]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[pyton]]></category>

		<guid isPermaLink="false">http://www.sheysrebellion.net/blog/?p=361</guid>
		<description><![CDATA[With most of the paperwork done I&#8217;ve started to make use of my free time in Toronto.  In an effort to improve my Python programming I implemented a cummulative sum estimation based change point detection algorithm in Pyton based on an article by Dr. Wayne A. Taylor.  The changepoint project is available on Google code&#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>With most of the paperwork done I&#8217;ve started to make use of my free time in Toronto.  In an effort to improve my Python programming I implemented a cummulative sum estimation based change point detection algorithm in Pyton based on an <a href="http://www.variation.com/cpa/tech/changepoint.html#Procedure">article by Dr. Wayne A. Taylor</a>.  The <a href="http://code.google.com/p/changepoint/">changepoint project</a> is available on Google code&#8211; all comments are apprecaited.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li><a rel="nofollow" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2009%2F08%2F19%2Fchange-point-analysis-in-python%2F&amp;title=Change%20point%20analysis%20in%20Python" title="del.icio.us"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2009%2F08%2F19%2Fchange-point-analysis-in-python%2F&amp;title=Change%20point%20analysis%20in%20Python" title="Reddit"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2009%2F08%2F19%2Fchange-point-analysis-in-python%2F&amp;t=Change%20point%20analysis%20in%20Python" title="Facebook"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2009%2F08%2F19%2Fchange-point-analysis-in-python%2F" title="Identi.ca"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" href="http://twitter.com/home?status=http%3A%2F%2Fwww.sheysrebellion.net%2Fblog%2F2009%2F08%2F19%2Fchange-point-analysis-in-python%2F" title="TwitThis"><img src="http://www.sheysrebellion.net/blog/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sheysrebellion.net/blog/2009/08/19/change-point-analysis-in-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

