<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Get with the program as contextmanager &#124; Completely Different</title>
	<atom:link href="http://jessenoller.com/2009/02/03/get-with-the-program-as-contextmanager-completely-different/feed/" rel="self" type="application/rss+xml" />
	<link>http://jessenoller.com/2009/02/03/get-with-the-program-as-contextmanager-completely-different/</link>
	<description>python, programming and other things</description>
	<lastBuildDate>Thu, 11 Feb 2010 00:42:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: bestchai</title>
		<link>http://jessenoller.com/2009/02/03/get-with-the-program-as-contextmanager-completely-different/comment-page-1/#comment-139159</link>
		<dc:creator>bestchai</dc:creator>
		<pubDate>Fri, 16 Oct 2009 20:16:02 +0000</pubDate>
		<guid isPermaLink="false">http://jessenoller.com/?p=461#comment-139159</guid>
		<description>&quot;This makes it so that when we call it on line 20 in Listing 5, we get the reference to the queue we need.&quot; should be line 18.</description>
		<content:encoded><![CDATA[<p>&#8220;This makes it so that when we call it on line 20 in Listing 5, we get the reference to the queue we need.&#8221; should be line 18.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bestchai</title>
		<link>http://jessenoller.com/2009/02/03/get-with-the-program-as-contextmanager-completely-different/comment-page-1/#comment-123070</link>
		<dc:creator>bestchai</dc:creator>
		<pubDate>Fri, 16 Oct 2009 15:16:02 +0000</pubDate>
		<guid isPermaLink="false">http://jessenoller.com/?p=461#comment-123070</guid>
		<description>&quot;This makes it so that when we call it on line 20 in Listing 5, we get the reference to the queue we need.&quot; should be line 18.</description>
		<content:encoded><![CDATA[<p>&#8220;This makes it so that when we call it on line 20 in Listing 5, we get the reference to the queue we need.&#8221; should be line 18.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yassen Damyanov</title>
		<link>http://jessenoller.com/2009/02/03/get-with-the-program-as-contextmanager-completely-different/comment-page-1/#comment-66926</link>
		<dc:creator>Yassen Damyanov</dc:creator>
		<pubDate>Mon, 02 Mar 2009 13:17:22 +0000</pubDate>
		<guid isPermaLink="false">http://jessenoller.com/?p=461#comment-66926</guid>
		<description>A very helpful article! Thanks a lot, Jessen.</description>
		<content:encoded><![CDATA[<p>A very helpful article! Thanks a lot, Jessen.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loris</title>
		<link>http://jessenoller.com/2009/02/03/get-with-the-program-as-contextmanager-completely-different/comment-page-1/#comment-64478</link>
		<dc:creator>Loris</dc:creator>
		<pubDate>Sat, 07 Feb 2009 10:44:53 +0000</pubDate>
		<guid isPermaLink="false">http://jessenoller.com/?p=461#comment-64478</guid>
		<description>very good article!&lt;br&gt;thank of lot</description>
		<content:encoded><![CDATA[<p>very good article!<br />thank of lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ed Page</title>
		<link>http://jessenoller.com/2009/02/03/get-with-the-program-as-contextmanager-completely-different/comment-page-1/#comment-64006</link>
		<dc:creator>Ed Page</dc:creator>
		<pubDate>Tue, 03 Feb 2009 18:41:08 +0000</pubDate>
		<guid isPermaLink="false">http://jessenoller.com/?p=461#comment-64006</guid>
		<description>The concept behind the design of contextlib.contextmanager changed the way I write Python.  I don&#039;t do this too much but I found the concept of splitting a function up with yields a great way to take a process that is fairly linear but due to language/library design gets split up and becomes harder to read.&lt;br&gt;&lt;br&gt;I&#039;ve created submodes for a command interpreter that are managed by a class that is created when decorating a yield-ing function to have setup and tear down code.&lt;br&gt;&lt;br&gt;I&#039;ve created decorators to work with PyGTK&#039;s idle handler for cooperative threading.  So instead of having separate functions for each step of the idle processing or using a hand made statemachine just to be in the correct section of code, you just writ your algorithm normally and insert yields when you want to hand control back to GTK&lt;br&gt;&lt;br&gt;I&#039;m working on one (untested) that will let you do your PyGTK setup code in the UI thread, background processing in a random thread, and then cleanup code in the UI thread.&lt;br&gt;&lt;br&gt;Oh, and another good example of the with statement beyond resource work is a python recipe for unit testing that I saw.  Basically you do &quot;with expected(ExceptionType)&quot; and if that exception isn&#039;t thrown, the test will fail.</description>
		<content:encoded><![CDATA[<p>The concept behind the design of contextlib.contextmanager changed the way I write Python.  I don&#39;t do this too much but I found the concept of splitting a function up with yields a great way to take a process that is fairly linear but due to language/library design gets split up and becomes harder to read.</p>
<p>I&#39;ve created submodes for a command interpreter that are managed by a class that is created when decorating a yield-ing function to have setup and tear down code.</p>
<p>I&#39;ve created decorators to work with PyGTK&#39;s idle handler for cooperative threading.  So instead of having separate functions for each step of the idle processing or using a hand made statemachine just to be in the correct section of code, you just writ your algorithm normally and insert yields when you want to hand control back to GTK</p>
<p>I&#39;m working on one (untested) that will let you do your PyGTK setup code in the UI thread, background processing in a random thread, and then cleanup code in the UI thread.</p>
<p>Oh, and another good example of the with statement beyond resource work is a python recipe for unit testing that I saw.  Basically you do &#8220;with expected(ExceptionType)&#8221; and if that exception isn&#39;t thrown, the test will fail.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
