<?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>The Mouse Vs. The Python &#187; Python</title>
	<atom:link href="http://www.blog.pythonlibrary.org/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blog.pythonlibrary.org</link>
	<description>Python Programming from the Frontlines</description>
	<lastBuildDate>Sun, 08 Jan 2012 12:45:28 +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>New Year&#8217;s Python Meme &#8211; #2012pythonmeme</title>
		<link>http://www.blog.pythonlibrary.org/2011/12/21/new-years-python-meme-2012pythonmeme/</link>
		<comments>http://www.blog.pythonlibrary.org/2011/12/21/new-years-python-meme-2012pythonmeme/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 02:15:30 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=2161</guid>
		<description><![CDATA[I was reading the Python blog feed yesterday and stumbled on Tarek Ziade&#8217;s Python Meme article. I thought it sounded like a fun idea, so here&#8217;s my answers to his questions. 1. What’s the coolest Python application, framework or library you have discovered in 2011? I can&#8217;t think of anything new that I&#8217;ve really used [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://www.blog.pythonlibrary.org/2011/12/21/new-years-python-meme-2012pythonmeme/" data-url="http://bit.ly/v8J1aJ" data-text="New Year&#8217;s Python Meme &#8211; #2012pythonmeme" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.blog.pythonlibrary.org/2011/12/21/new-years-python-meme-2012pythonmeme/&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-left"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.blog.pythonlibrary.org/2011/12/21/new-years-python-meme-2012pythonmeme/";
			reddit_title = "New Year&#8217;s Python Meme &#8211; #2012pythonmeme";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-left"><g:plusone size="small" href="http://www.blog.pythonlibrary.org/2011/12/21/new-years-python-meme-2012pythonmeme/"></g:plusone></div></div><p>I was reading the Python blog feed yesterday and stumbled on Tarek Ziade&#8217;s <a href="http://tarekziade.wordpress.com/2011/12/20/new-years-python-meme-2/" target="_blank">Python Meme article</a>. I thought it sounded like a fun idea, so here&#8217;s my answers to his questions. <span id="more-2161"></span></p>
<p><strong>1. What’s the coolest Python application, framework or library you have discovered in 2011?</strong></p>
<p>I can&#8217;t think of anything new that I&#8217;ve really used this year. However, this was the year that I started using the <a href="http://pypi.python.org/pypi/ObjectListView" target="_blank">ObjectListView </a>widget in wxPython pretty extensively. It&#8217;s a great wrapper around the wx.ListCtrl that just makes it super easy to use. This is also the year that I started working on a big <a href="http://turbogears.org/" target="_blank">TurboGears 2</a> project, but I haven&#8217;t decided if it&#8217;s my favorite yet.</p>
<p><strong>2. What new programming technique did you learn in 2011?</strong></p>
<p>Lately I&#8217;ve taken to keeping my code more organized and structured than I have in the past, splitting my components into different modules, refactoring a lot more, trying to follow the Model-View-Controller schema more, etc. I have also started using <a href="http://mercurial.selenic.com/" target="_blank">Mercurial</a> source control and <a href="https://bitbucket.org/" target="_blank">BitBucket</a> much more this year. I&#8217;m still not an expert in using them, but I know enough to keep my source mostly safe.</p>
<p><strong>3. What’s the name of the open source project you contributed the most in 2011? What did you do?</strong></p>
<p><strong>wxPython</strong>. I write a lot of documentation for it on my wiki and I help lots of people with understanding it on the wxPython mailing list and on StackOverflow.</p>
<p><strong>4. What was the Python blog or website you read the most in 2011?</strong></p>
<p>Umm, this is a tough one. I read <a href="http://ramblings.timgolden.me.uk/" target="_blank">Tim Golden&#8217;s</a> a lot with a dash of <a href="http://jessenoller.com/" target="_blank">Jesse Noller</a> and <a href="http://blog.doughellmann.com/" target="_blank">Doug Hellman</a>. I like <a href="http://www.dabeaz.com/blog.html" target="_blank">David Beazley</a> too, but he doesn&#8217;t write much.</p>
<p><strong>5. What are the three top things you want to learn in 2012?</strong></p>
<p>I need to get a better handle on Mercurial branching and merging. Learning more TurboGears and maybe another Python web framework. Testing (I know some, but not enough, especially as related to GUIs).</p>
<p><strong>6. What are the top software, app or lib you wish someone would write in 2012?</strong></p>
<p>I wish there was a better eBay wrapper. I&#8217;d like to write my own sniper script. Another nice one would be some kind of all-in-one script that could create my bit.ly link for my blog post and then submit it to the various major tech sites for me.</p>
<p>Want to do your own list? here’s how:</p>
<ul>
<li>copy-paste the questions and answer to them in your blog</li>
<li>tweet it with the <a href="https://twitter.com/#!/search/%232012pythonmeme" target="_blank">#2012pythonmeme</a> hashtag</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.pythonlibrary.org/2011/12/21/new-years-python-meme-2012pythonmeme/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Python Voted Best Programming Language 3 Years Running</title>
		<link>http://www.blog.pythonlibrary.org/2011/12/07/python-voted-best-programming-language-3-years-running/</link>
		<comments>http://www.blog.pythonlibrary.org/2011/12/07/python-voted-best-programming-language-3-years-running/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 18:49:43 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Advocacy]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=2108</guid>
		<description><![CDATA[The Linux Journal readers have good taste. This is the 3rd year that they have voted Python as the Best Programming Language. Oddly enough, C++ is the runner-up. I personally liked C++ when I was in school, but the two languages are quite different. On the other hand, Python interfaces with C/C++ pretty well, so [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://www.blog.pythonlibrary.org/2011/12/07/python-voted-best-programming-language-3-years-running/" data-url="http://bit.ly/vBds2S" data-text="Python Voted Best Programming Language 3 Years Running" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.blog.pythonlibrary.org/2011/12/07/python-voted-best-programming-language-3-years-running/&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px !important; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-left"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.blog.pythonlibrary.org/2011/12/07/python-voted-best-programming-language-3-years-running/";
			reddit_title = "Python Voted Best Programming Language 3 Years Running";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-left"><g:plusone size="small" href="http://www.blog.pythonlibrary.org/2011/12/07/python-voted-best-programming-language-3-years-running/"></g:plusone></div></div><p>The <a href="http://www.linuxjournal.com/slideshow/readers-choice-2011?page=27" target="_blank">Linux Journal</a> readers have good taste. This is the 3rd year that they have voted Python as the <strong>Best Programming Language</strong>. Oddly enough, C++ is the runner-up. I personally liked C++ when I was in school, but the two languages are quite different. On the other hand, Python interfaces with C/C++ pretty well, so maybe the readers of that magazine like to do mash-ups with the two languages. You will also note that they voted Python as the <a href="http://www.linuxjournal.com/slideshow/readers-choice-2011?page=28" target="_blank">Best Scripting Language</a> too.</p>
<p>Congrats to the Python community and the PSF too!</p>
<p>Hat-tip to <a href="http://holdenweb.com/" target="_blank">Steve Holden</a> who mentioned this on Python.org&#8217;s <a href="http://www.python.org/news/index.html#Wed7December20111010-0800" target="_blank">news feed</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.pythonlibrary.org/2011/12/07/python-voted-best-programming-language-3-years-running/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Python Links for the Week: 7/22/2011</title>
		<link>http://www.blog.pythonlibrary.org/2011/07/22/python-links-for-the-week-7222011/</link>
		<comments>http://www.blog.pythonlibrary.org/2011/07/22/python-links-for-the-week-7222011/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 22:00:40 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Python Advocacy]]></category>

		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=1843</guid>
		<description><![CDATA[Another week is over and we have a new set of articles for you to check out this weekend. You can learn new things, try modules, and be productive. Or you can go party. Don&#8217;t forget about all the different PyCons going on this year around the world. There are local ones and International conferences. [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://www.blog.pythonlibrary.org/2011/07/22/python-links-for-the-week-7222011/" data-url="http://bit.ly/v9mVWw" data-text="Python Links for the Week: 7/22/2011" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.blog.pythonlibrary.org/2011/07/22/python-links-for-the-week-7222011/&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>Another week is over and we have a new set of articles for you to check out this weekend. You can learn new things, try modules, and be productive. Or you can go party. Don&#8217;t forget about all the different PyCons going on this year around the world. There are local ones and International conferences.</p>
<ul>
<li>Multiple reviews for the <a href="http://www.amazon.com/gp/product/1849514666/ref=as_li_ss_tl?ie=UTF8&#038;tag=thmovsthpy-20&#038;linkCode=as2&#038;camp=217145&#038;creative=399373&#038;creativeASIN=1849514666" rel="nofollow">Python Testing Cookbook&#8221; target=&#8221;_blank&#8221;>Python Testing Cookbook</a> are out now. See <a href="http://streamhacker.com/2011/07/18/python-testing-cookbook-review/" target="_blank">Jacob Perkins</a> or <a href="http://blog.doughellmann.com/2011/07/book-review-python-testing-cookbook.html" target="_blank">Doug Hellman&#8217;s</a> reviews</li>
<li>Learn why SqlAlchemy rocks and how it&#8217;s different from Django&#8217;s ORM in Armin Ronacher&#8217;s <a href="http://lucumr.pocoo.org/2011/7/19/sqlachemy-and-you/" target="_blank">article</a></li>
<li>Speaking of Django, this article is an introduction to <a href="http://eli.thegreenplace.net/2011/06/24/how-django-sessions-work-introduction/" target="_blank">sessions in Django</a></li>
<li><a href="http://cloudnumbers.com/your-python-application-in-the-cloud" target="_blank">Python Application in the Cloud</a></li>
<li><a href="http://gc-taylor.com/blog/2011/7/20/exocet-makes-code-reloading-easy/" target="_blank">Re-load modules or import them without import</a> with Exocet</li>
<li>A Python 4 Kids <a href="http://python4kids.wordpress.com/2011/07/18/tkinter-tinkering-graphical-user-interfaces/" target="_blank">Tkinter tutorial</a></li>
<li><a href="http://pythonsprints.com/2011/07/22/pyohio-conference-and-sprints-osu/" target="_blank">PyOhio </a></li>
<p>is next weekend!</p>
<li><a href="http://pythonconquerstheuniverse.wordpress.com/2011/07/22/read-ahead-and-python-generators/" target="_blank">Read-Ahead and Python Generators</a></li>
<li><a href="http://ruslanspivak.com/2011/07/20/how-to-convert-python-utc-datetime-object-to-unix-timestamp/" target="_blank">How to convert Python UTC datetime to UNIX timestamp</a></li>
</ul>
<p>That&#8217;s all for this week. Let me know if you find anything cool that you think I should highlight next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.pythonlibrary.org/2011/07/22/python-links-for-the-week-7222011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Links for the week (06/03/2011)</title>
		<link>http://www.blog.pythonlibrary.org/2011/06/03/python-links-for-the-week-06032011/</link>
		<comments>http://www.blog.pythonlibrary.org/2011/06/03/python-links-for-the-week-06032011/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 22:30:15 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Python Advocacy]]></category>

		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=1805</guid>
		<description><![CDATA[It&#8217;s been a while since I have done any interesting Python links. I quit for a while because these things take a while to put together and few seemed interested, but I&#8217;ll give it another go. This week has a really interesting article on Python and robots. Jesse Noller has a fun article where he [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://www.blog.pythonlibrary.org/2011/06/03/python-links-for-the-week-06032011/" data-url="http://bit.ly/tm1TZl" data-text="Python Links for the week (06/03/2011)" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.blog.pythonlibrary.org/2011/06/03/python-links-for-the-week-06032011/&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>It&#8217;s been a while since I have done any interesting Python links. I quit for a while because these things take a while to put together and few seemed interested, but I&#8217;ll give it another go. This week has a really interesting article on Python and robots. Jesse Noller has a fun article where he collects various Python stories too (I nabbed a couple of his picks for mine too because he was right: they <em>are </em>interesting!)</p>
<ul>
<li><a href="http://blog.aicookbook.com/2010/06/building-a-face-tracking-robot-headroid1-with-python-in-an-afternoon/">Building a face-tracking robot (Headroid1) with Python in an afternoon</a></li>
<li><a href="http://jessenoller.com/2011/05/31/python-debugging-embarrassment-contracts-and-nothing-is-private/">Python Debugging; Embarrassment, Contracts and Nothing is private (Jesse Noller)</a></li>
<li><a href="http://www.voidspace.org.uk/python/weblog/arch_d7_2011_05_28.shtml#e1214">Nothing is Private: Python Closures (and ctypes)</a> &#8211; Michael Foord</li>
<li><a href="http://blog.ccpgames.com/kristjan/2011/05/28/namedtuple-and-exec/">namedtuple and exec()</a> by Kristján Valur</li>
<li>Both <a href="http://pycon.blogspot.com/2011/05/pytexas-2011-call-for-proposals.html">PyTexas </a>and <a href="http://pycon.blogspot.com/2011/05/pycon-jp-2011-call-for-proposals.html">PyCon Japan</a> are calling for papers so if you like talking about Python, get in on the action now!</li>
<li><a href="http://www.voidspace.org.uk/python/weblog/arch_d7_2011_05_28.shtml">mock 0.7.2</a> and <a href="http://pydev.blogspot.com/2011/05/pydev-210-released.html">PyDev 2.1.0</a> were both released recently.</li>
<li><a href="http://jeetworks.org/node/99">Quick and Easy Debugging in Python</a> by Jeet Sukumaran</li>
<li><a href="http://nedbatchelder.com/blog/201105/teaching_and_learning_python.html">Teaching (and learning) Python</a> by Ned Batchelder</li>
<li><a href="http://nedbatchelder.com/blog/201106/filenames_with_accents.html">Filenames with accents</a> by Ned Batchelder</li>
</ul>
<p>If you think I missed something awesome that happened in the Python world recently, let me know in the comments and maybe I&#8217;ll add it next time. Thanks for your support!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.pythonlibrary.org/2011/06/03/python-links-for-the-week-06032011/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PyCon 2011: Interview with Wesley Chun</title>
		<link>http://www.blog.pythonlibrary.org/2011/02/21/pycon-2011-interview-with-wesley-chun/</link>
		<comments>http://www.blog.pythonlibrary.org/2011/02/21/pycon-2011-interview-with-wesley-chun/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 18:24:59 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[PyCon]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[PyCon 2011]]></category>

		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=1691</guid>
		<description><![CDATA[As PyCon approaches, the blogger community was invited to interview the speakers that are coming to the event. I chose Wesley Chun, writer of Core Python Programming and co-author of Python Web Development with Django. In this interview, I ask Wesley about his talk, Running Django Apps on Google App Engine and about PyCon in [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://www.blog.pythonlibrary.org/2011/02/21/pycon-2011-interview-with-wesley-chun/" data-url="http://bit.ly/urvZ8E" data-text="PyCon 2011: Interview with Wesley Chun" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.blog.pythonlibrary.org/2011/02/21/pycon-2011-interview-with-wesley-chun/&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>As PyCon approaches, the blogger community was invited to interview the speakers that are coming to the event. I chose Wesley Chun, writer of <a href="http://amzn.to/eWHV7i">Core Python Programming</a> and co-author of <a href="http://amzn.to/hai9UI">Python Web Development with Django</a>. In this interview, I ask Wesley about his talk, <a href="http://us.pycon.org/2011/schedule/presentations/237/">Running Django Apps on Google App Engine</a> and about PyCon in general. Let’s see what he has to say:<span id="more-1691"></span></p>
<p><strong>1) What do you want the attendees to take away from this talk?</strong></p>
<p>I&#8217;d like all attendees to come away from this talk with a greater sense of optimism they can take their Django apps and run them with little or no modification on Google App Engine, taking advantage of the scalability they need and is so difficult to achieve on your own.</p>
<p>Part of this talk is pseudo-marketing to bring more awareness to Django-nonrel, which is the foundation of how to get Django apps to run on App Engine. For the past several years since App Engine debuted in 2008, there have been several tools, called the Helper and the Patch, to help you run Django apps on App Engine. Unfortunately, those older systems required you to modify your apps&#8217; data models in order to get them to run on App Engine. This is not the case with Django-nonrel, which should take its place as the leading tool that users should use when desiring to run Django apps on any NoSQL or non-relational database.</p>
<p>Along with Django-nonrel, developers also need the corresponding NoSQL adapter code, djangoappengine (for Google App Engine&#8217;s datastore), Django-mongodb-engine (for MongoDB). they (and others) are working on adapters to other NoSQL databases, but more exciting than that is the prospect of having NoSQL JOINs!</p>
<p><strong>2) What made you decide to speak on this topic?</strong></p>
<p>I wanted to give this talk for many reasons&#8230; I already mentioned awareness earlier. The other thing is that people are so used to the Helper and the Patch, that they don&#8217;t realize there&#8217;s a better tool out there.</p>
<p>Another important reason is the concept of vendor lock-in, the phenomenon where you can&#8217;t easily migrate your apps and/or data to different platforms because you&#8217;re &#8220;locked in&#8221; by your current vendor. people complain that you can&#8217;t run App Engine apps anywhere else, but this is not true. You can choose a different backend besides Google&#8217;s original&#8230; two of these backends are AppScale and TyphoonAE. similarly, if you created a Django app and ran it via traditional hosting, Django-nonrel helps you bring it to App Engine with very little porting. Similarly, if you write a Django app and run it on App Engine using Django-nonrel, it shouldn&#8217;t take much work to move it to traditional hosting.</p>
<p><strong>3) What are the pros and cons in using Django on Google App Engine?</strong></p>
<p>The most obvious pro is scalability. This is something that&#8217;s both very difficult and very expensive to build. why not take advantage of all the smart people at Google that have built scalability into their core infrastructure that helps them be&#8230;, well, Google! With Django-nonrel, if Google isn&#8217;t right for you, you can take your app and run it elsewhere! no vendor lock-in here.</p>
<p>One con would be that App Engine&#8217;s datastore is still difficult to wrap your head around if you&#8217;re used to the traditional relational database model. you can&#8217;t do raw SQL or JOINs completely yet. Google does give you a stripped-down SQL syntax known as GQL, but it&#8217;s not the complete picture. Also, in exchange for its benefits, you do have to give up some control over your app by letting Google host it. you can&#8217;t use any C/C++ extensions, and don&#8217;t have access to your logs or other raw files.</p>
<p><strong>4) What are you most looking forward to at PyCon this year?</strong></p>
<p>I&#8217;m looking forward to connecting with familiar and friendly faces of those I&#8217;ve met over the past decade of attending Python and open source conferences. Because we&#8217;re all so geographically diverse, it&#8217;s the one time you can count on to see people you haven&#8217;t seen in a year and to catch up, either in the exhibit hall or part of an interesting hallway conversation.</p>
<p>I&#8217;m also excited to learn new things that are part of the Python universe. every year it seems to grow a bit more, so it&#8217;s a struggle to stay up-to-date with what&#8217;s been going on in the community. I&#8217;m also looking forward to reprising my Python 3 talk from last year, partly because it&#8217;s becoming more important every year, and as part of my research for the talk, I&#8217;ll be finding out which projects have moved to Python 3.</p>
<p><strong>5) What were your favorite parts of PyCon in previous years?</strong></p>
<p>The best part of the Python ecosphere is having a great programming language to rally behind, but the next best thing is the people&#8230; the Python community itself. And PyCon is the best place to interact with the community. the conference is phenomenal because of the talks, ability to reach to all skill levels (from beginner through advanced), superb tutorials stretching across TWO days, compelling session talks, amazing lightning talks and open space sessions, and of course, the hallway conversations, not to mention that crazy memes and hacks such as OHwar &#8211;<a href="http://pycon.ohwar.com">http://pycon.ohwar.com</a> &#8212; that come from such convos.</p>
<p><strong>Just think: you could meet your favorite Python author at PyCon this year AND learn about Django and Google App Engine at the same time. And if that doesn’t float your boat, Wesley is also doing a talk on Python 3. What are you waiting for? Get on over to the <a href="http://us.pycon.org/2011/home/">PyCon website</a> and sign yourself up!</strong></p>
<p><em>Note: This article cross-posted to the <a href="http://us.pycon.org/2011/blog/2011/02/14/pycon-2011-interview-wesley-chun/">PyCon blog</a><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.pythonlibrary.org/2011/02/21/pycon-2011-interview-with-wesley-chun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weekly Python News: 02/11/2011</title>
		<link>http://www.blog.pythonlibrary.org/2011/02/11/weekly-python-news-02112011/</link>
		<comments>http://www.blog.pythonlibrary.org/2011/02/11/weekly-python-news-02112011/#comments</comments>
		<pubDate>Fri, 11 Feb 2011 23:30:21 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Flask]]></category>
		<category><![CDATA[PyCon 2011]]></category>

		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=1678</guid>
		<description><![CDATA[This weekly edition of Python News has quite the variety of topics. You can learn about how to create passwords, the new Enthought Python Distribution and about something called pylibftdi. Plus, I&#8217;ve added a section just for PyCon related stuff since they seem to be releasing a lot of info this month. For example, there&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://www.blog.pythonlibrary.org/2011/02/11/weekly-python-news-02112011/" data-url="http://bit.ly/u5SiHs" data-text="Weekly Python News: 02/11/2011" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.blog.pythonlibrary.org/2011/02/11/weekly-python-news-02112011/&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>This weekly edition of Python News has quite the variety of topics. You can learn about how to create passwords, the new Enthought Python Distribution and about something called pylibftdi. Plus, I&#8217;ve added a section just for PyCon related stuff since they seem to be releasing a lot of info this month. For example, there&#8217;s an interview with Armin Ronacher (author of Flask) in that section. </p>
<ul>
<li>Peter Fein talks about <a href="http://blog.wearpants.org/better-passwords-in-under-200-characters">Better Passwords in Under 200 Characters</a></li>
<li><a href="http://posted-stuff.blogspot.com/2011/02/sphinx-and-htmlhelp.html">Sphinx and htmlhelp</a></li>
<li>Enthought Python Distribution version 7.0 <a href="http://blog.enthought.com/general/epd-7-0-released/">released </a>this week.</li>
<li>pylibftdi 0.7 &#8211; <a href="http://codedstructure.blogspot.com/2011/02/pylibftdi-07-multiple-device-support.html">multiple device support </a></li>
<li>Python’s dictionary <a href="http://www.laurentluce.com/?p=249">implementation</a></li>
<li><a href="http://tarekziade.wordpress.com/2011/02/10/a-simple-self-upgrade-build-pattern/">A simple self-upgrade build pattern</a></li>
<li>`cute_profile`: <a href="http://blog.garlicsim.org/post/3234111101/cute-profile-profile-your-python-code-on-the-fly">Profile your Python code on the fly</a></li>
</ul>
<p><strong>PyCon News</strong></p>
<ul>
<li>Press release: <a href="http://pycon.blogspot.com/2011/02/press-release-record-breaking.html">Record-Breaking Submissions to PyCon 2011</a></li>
<li>PyCon 2011: <a href="http://us.pycon.org/2011/blog/2011/02/10/pycon-2011-interview-armin-ronacher-opening-flask/">Interview with Armin Ronacher</a> &#8211; “Opening the Flask”</li>
</ul>
<p>So far no one has ever given me any leads for my next article, so that either means I&#8217;m doing something right or no one&#8217;s reading these posts. Well, as always, I will take a look at any links that my kind readers give me. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.pythonlibrary.org/2011/02/11/weekly-python-news-02112011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weekly Python News: 02/04/2011</title>
		<link>http://www.blog.pythonlibrary.org/2011/02/04/weekly-python-news-02042011/</link>
		<comments>http://www.blog.pythonlibrary.org/2011/02/04/weekly-python-news-02042011/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 23:30:57 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[PyPI]]></category>
		<category><![CDATA[ReST]]></category>
		<category><![CDATA[Sphinx]]></category>

		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=1657</guid>
		<description><![CDATA[It&#8217;s time for your weekly dose of Python news. What happened in the last week? Or what did I find that I thought was newsy? Lots of stuff, it turns out. This week, you can learn about the controversy of PyPI, Tablib, a &#8220;fireside&#8221; chat with Python&#8217;s founder that&#8217;s coming up next month at PyCon [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://www.blog.pythonlibrary.org/2011/02/04/weekly-python-news-02042011/" data-url="http://bit.ly/sVzWdC" data-text="Weekly Python News: 02/04/2011" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.blog.pythonlibrary.org/2011/02/04/weekly-python-news-02042011/&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>It&#8217;s time for your weekly dose of Python news. What happened in the last week? Or what did I find that I thought was newsy? Lots of stuff, it turns out. This week, you can learn about the controversy of PyPI, Tablib, a &#8220;fireside&#8221; chat with Python&#8217;s founder that&#8217;s coming up next month at PyCon USA and more. </p>
<ul>
<li><a href="http://blog.aclark.net/2011/01/31/in-defense-of-pypi/">In Defense of PyPI</a></li>
<li>Tablib <a href="http://kennethreitz.com/blog/tablib-community-update/">update</a></li>
<li>Enthought&#8217;s reStructuredText <a href="http://posted-stuff.blogspot.com/2011/02/enthoughts-restructuredtext-editor.html">editor</a></li>
<li>A fun, short article on Sphinx <a href="http://reinout.vanrees.org/weblog/2011/02/01/sphinx-project-documentation.html">documentation</a></li>
<li>PyCon 2011: Announcing <a href="http://us.pycon.org/2011/blog/2011/02/02/pycon-2011-announcing-fireside-chat-guido-van-ross/">&#8220;A Fireside Chat with Guido van Rossum&#8221;</a></li>
<li><a href="http://plope.com/Members/chrism/floss_weekly_pylons">FLOSS Weekly Interviews the Pylons Project</a></li>
<li><a href="http://www.mapforums.com/add-city-coverage-mappoint-using-geonames-database-15244.html">Add City Coverage to MapPoint using the GeoNames Database</a></li>
<li>Help Mike Pirnat by giving him topics for his PyCon <a href="http://mike.pirnat.com/2011/02/04/speaking-at-pycon-2011">talk</a></li>
<li>Jenkins (FKA: Hudson) is now <a href="http://pythontestingcookbook.posterous.com/jenkins-download-available">available</a></li>
</ul>
<p>I hope you find a few of those links useful or interesting. Feel free to give me a few for next week in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.pythonlibrary.org/2011/02/04/weekly-python-news-02042011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weekly Python News: 01/28/2011</title>
		<link>http://www.blog.pythonlibrary.org/2011/01/28/weekly-python-news-01282011/</link>
		<comments>http://www.blog.pythonlibrary.org/2011/01/28/weekly-python-news-01282011/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 23:34:21 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[PyQT]]></category>
		<category><![CDATA[Python 3]]></category>
		<category><![CDATA[Sprints]]></category>
		<category><![CDATA[WSGI]]></category>

		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=1614</guid>
		<description><![CDATA[It&#8217;s almost the end of January already and PyCon USA 2011 is just around the corner. In this edition, we cover a wide variety of topics, from Python 2.7 &#8211; 3.x. We&#8217;ve got sprints, new books, web-related projects and good old recursion articles. Come one, come all! Read the news of the week! eWeek reports [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://www.blog.pythonlibrary.org/2011/01/28/weekly-python-news-01282011/" data-url="http://bit.ly/sQjyx8" data-text="Weekly Python News: 01/28/2011" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.blog.pythonlibrary.org/2011/01/28/weekly-python-news-01282011/&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>It&#8217;s almost the end of January already and PyCon USA 2011 is just around the corner. In this edition, we cover a wide variety of topics, from Python 2.7 &#8211; 3.x. We&#8217;ve got sprints, new books, web-related projects and good old recursion articles. Come one, come all! Read the news of the week!</p>
<ul>
<li><a href="http://www.eweek.com/c/a/IT-Management/Java-Python-Apex-Windows-Top-List-of-IT-Skills-in-Demand-This-Year-507117/">eWeek reports</a> that Python Skills are in demand this year</li>
<li><a href="http://techspot.zzzeek.org/2011/01/24/zzzeek-s-guide-to-python-3-porting/">zzzeek&#8217;s Guide to Python 3 Porting</a> by Michael Bayer, the man behind SqlAlchemy. </li>
<li><a href="http://rhodesmill.org/brandon/2011/foundations-of-python-network-programming/">Foundations of Python Network Programming</a>: A Last Hurrah For Python 2. Brandon Rhodes (former editor of Python Magazine) talks about a book he just finished writing.</li>
<li>Python Sprints is sponsoring <a href="http://pythonsprints.com/2011/01/25/sponsoring-software-carpentry-2011/">Software Carpentry 2011</a>. Details are sparse and I&#8217;m not really familiar with either organization, but this sounds interesting.</li>
<li>Shannon Behrens talks about <a href="http://jjinux.blogspot.com/2011/01/python-ssl-hell.html">Python SSL Hell</a> on his blog</li>
<li>Learn how to deploy <a href="http://blog.schmichael.com/2011/01/25/deploying-python-behind-nginx-talk-slides/">Python WSGI apps behind nginx</a></li>
<li><a href="http://pysnippet.blogspot.com/2010/01/new-style-pyqt-signals-and-slots.html">Learn New-style PyQt Signals and Slots</a> on Mario Boikov&#8217;s blog</li>
<li><a href="http://sayspy.blogspot.com/2011/01/building-python-with-llvm-28-and-why-i.html">Building Python with LLVM 2.8</a> (and why I still love the project) by Brett Cannon. </li>
<li>A little discussion of tail recursion can be found in the following article: <a href="http://jasonmbaker.com/tail-recursion-in-python-using-pysistence">Tail Recursion in Python using Pysistence</a></li>
</ul>
<p>On the PyCon front, you should take note the <a href="http://us.pycon.org/2011/blog/2011/01/27/early-bird-over/">Early Bird pricing is now over</a>. Why did you wait? Fortunately, they are still selling tickets, so stop stalling and just come! The PyCon <a href="http://us.pycon.org/2011/blog/2011/01/27/so-you-want-or-know-someone-who-would-be-pycon-spo/">blog </a>also mentions that they&#8217;re still looking for sponsors, so if you or someone you know has that kind of cashola, point them in that direction.</p>
<p>And now we return you back to your regularly scheduled blog reading&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.pythonlibrary.org/2011/01/28/weekly-python-news-01282011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wxPython: A Wizard Tutorial</title>
		<link>http://www.blog.pythonlibrary.org/2011/01/27/wxpython-a-wizard-tutorial/</link>
		<comments>http://www.blog.pythonlibrary.org/2011/01/27/wxpython-a-wizard-tutorial/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 03:02:56 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[wxPython]]></category>
		<category><![CDATA[Wizard]]></category>

		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=1627</guid>
		<description><![CDATA[In this article, we will be looking at wxPython&#8217;s Wizard widget. No, it has nothing to do with Dumbledore or Gandalf. Instead, it is that dialog that you&#8217;ll see when you run an installer or set up a template. Sometimes you&#8217;ll even see them used for setting up mail merge. We will cover two examples [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://www.blog.pythonlibrary.org/2011/01/27/wxpython-a-wizard-tutorial/" data-url="http://bit.ly/tfMm4q" data-text="wxPython: A Wizard Tutorial" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.blog.pythonlibrary.org/2011/01/27/wxpython-a-wizard-tutorial/&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>In this article, we will be looking at wxPython&#8217;s Wizard widget. No, it has nothing to do with Dumbledore or Gandalf. Instead, it is that dialog that you&#8217;ll see when you run an installer or set up a template. Sometimes you&#8217;ll even see them used for setting up mail merge. We will cover two examples in this tutorial: one that is fairly simple and another that is slightly more complex. Let&#8217;s get started!</p>
<p><em>Note: The code in this article was adapted from the wxPython Demo application</em></p>
<p><span id="more-1627"></span></p>
<h2>A Simple Wizard</h2>
<p><a href="http://www.blog.pythonlibrary.org/wp-content/uploads/2011/01/simple_wizard.png"><img src="http://www.blog.pythonlibrary.org/wp-content/uploads/2011/01/simple_wizard.png" alt="" title="simple_wizard.png" width="296" height="370" class="aligncenter size-full wp-image-1639" /></a></p>
<p>When you need to use a wizard in wxPython, you&#8217;ll want to import it in a special way. Instead of just importing <strong>wx</strong>, you will have to do this:<strong> import wx.wizard</strong>. Also note that there are two primary types of wizard pages: WizardPageSimple and PyWizardPage. The former is the easiest, so we&#8217;ll use that in our simple example. Here&#8217;s the code:</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> wx
<span style="color: #ff7700;font-weight:bold;">import</span> wx.<span style="color: black;">wizard</span> as wiz
&nbsp;
<span style="color: #808080; font-style: italic;">########################################################################</span>
<span style="color: #ff7700;font-weight:bold;">class</span> TitledPage<span style="color: black;">&#40;</span>wiz.<span style="color: black;">WizardPageSimple</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, parent, title<span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;Constructor&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
        wiz.<span style="color: black;">WizardPageSimple</span>.<span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, parent<span style="color: black;">&#41;</span>
&nbsp;
        sizer = wx.<span style="color: black;">BoxSizer</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">VERTICAL</span><span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">SetSizer</span><span style="color: black;">&#40;</span>sizer<span style="color: black;">&#41;</span>
&nbsp;
        title = wx.<span style="color: black;">StaticText</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, <span style="color: #ff4500;">-1</span>, title<span style="color: black;">&#41;</span>
        title.<span style="color: black;">SetFont</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">Font</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">18</span>, wx.<span style="color: black;">SWISS</span>, wx.<span style="color: black;">NORMAL</span>, wx.<span style="color: black;">BOLD</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        sizer.<span style="color: black;">Add</span><span style="color: black;">&#40;</span>title, <span style="color: #ff4500;">0</span>, wx.<span style="color: black;">ALIGN_CENTRE</span>|wx.<span style="color: black;">ALL</span>, <span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>
        sizer.<span style="color: black;">Add</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">StaticLine</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, <span style="color: #ff4500;">-1</span><span style="color: black;">&#41;</span>, <span style="color: #ff4500;">0</span>, wx.<span style="color: black;">EXPAND</span>|wx.<span style="color: black;">ALL</span>, <span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
    wizard = wx.<span style="color: black;">wizard</span>.<span style="color: black;">Wizard</span><span style="color: black;">&#40;</span><span style="color: #008000;">None</span>, <span style="color: #ff4500;">-1</span>, <span style="color: #483d8b;">&quot;Simple Wizard&quot;</span><span style="color: black;">&#41;</span>
    page1 = TitledPage<span style="color: black;">&#40;</span>wizard, <span style="color: #483d8b;">&quot;Page 1&quot;</span><span style="color: black;">&#41;</span>
    page2 = TitledPage<span style="color: black;">&#40;</span>wizard, <span style="color: #483d8b;">&quot;Page 2&quot;</span><span style="color: black;">&#41;</span>
    page3 = TitledPage<span style="color: black;">&#40;</span>wizard, <span style="color: #483d8b;">&quot;Page 3&quot;</span><span style="color: black;">&#41;</span>
    page4 = TitledPage<span style="color: black;">&#40;</span>wizard, <span style="color: #483d8b;">&quot;Page 4&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
    wx.<span style="color: black;">wizard</span>.<span style="color: black;">WizardPageSimple</span>.<span style="color: black;">Chain</span><span style="color: black;">&#40;</span>page1, page2<span style="color: black;">&#41;</span>
    wx.<span style="color: black;">wizard</span>.<span style="color: black;">WizardPageSimple</span>.<span style="color: black;">Chain</span><span style="color: black;">&#40;</span>page2, page3<span style="color: black;">&#41;</span>
    wx.<span style="color: black;">wizard</span>.<span style="color: black;">WizardPageSimple</span>.<span style="color: black;">Chain</span><span style="color: black;">&#40;</span>page3, page4<span style="color: black;">&#41;</span>
    wizard.<span style="color: black;">FitToPage</span><span style="color: black;">&#40;</span>page1<span style="color: black;">&#41;</span>
&nbsp;
    wizard.<span style="color: black;">RunWizard</span><span style="color: black;">&#40;</span>page1<span style="color: black;">&#41;</span>
&nbsp;
    wizard.<span style="color: black;">Destroy</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
    app = wx.<span style="color: black;">App</span><span style="color: black;">&#40;</span><span style="color: #008000;">False</span><span style="color: black;">&#41;</span>
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    app.<span style="color: black;">MainLoop</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre>
<p>That&#8217;s a fair bit of code. Let&#8217;s take it a part and see if we can figure it out. First off, we import wx and the wizard which we rename &#8220;wiz&#8221; to save on keystrokes. Next, we create a <strong>TitledPage</strong> class that subclasses <strong>WizardPageSimple</strong>. This class will be the basis for all the pages in our wizard. It basically just defines a page that has a centered title in 18 point font with a line underneath.</p>
<p>In the <strong>main</strong> function we find the real meat. Here we create the wizard using the following syntax: <strong>wx.wizard.Wizard(None, -1, &#8220;Simple Wizard&#8221;)</strong>. This gives the wizard a parent of None, an id and a title. Then we create four pages which are instances of the <strong>TitledPage</strong> class that we mentioned earlier. Finally, we use <strong>wx.wizard.WizardPageSimple.Chain</strong> to chain the pages together. This allows us to use a couple of automatically generated buttons to page forwards and backwards through the pages. The last couple of lines of code will run the wizard and when the user is done, will destroy the wizard. Pretty simple, right? Now let&#8217;s move on to the more advanced example.</p>
<h2>Using PyWizardPage</h2>
<p><a href="http://www.blog.pythonlibrary.org/wp-content/uploads/2011/01/adv_wizard.png"><img src="http://www.blog.pythonlibrary.org/wp-content/uploads/2011/01/adv_wizard.png" alt="" title="adv_wizard.png" width="427" height="370" class="aligncenter size-full wp-image-1640" /></a></p>
<p>In this section, we will create a subclass of <strong>PyWizardPage</strong>. We will also have a WizardPageSimple subclass so that we can mix and match the two to create a series of different pages. Let&#8217;s just jump to the code so you can see it for yourself!</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> images
<span style="color: #ff7700;font-weight:bold;">import</span> wx
<span style="color: #ff7700;font-weight:bold;">import</span> wx.<span style="color: black;">wizard</span> as wiz
&nbsp;
<span style="color: #808080; font-style: italic;">########################################################################</span>
<span style="color: #ff7700;font-weight:bold;">class</span> TitledPage<span style="color: black;">&#40;</span>wiz.<span style="color: black;">WizardPageSimple</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, parent, title<span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;Constructor&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
        wiz.<span style="color: black;">WizardPageSimple</span>.<span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, parent<span style="color: black;">&#41;</span>
&nbsp;
        sizer = wx.<span style="color: black;">BoxSizer</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">VERTICAL</span><span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">sizer</span> = sizer
        <span style="color: #008000;">self</span>.<span style="color: black;">SetSizer</span><span style="color: black;">&#40;</span>sizer<span style="color: black;">&#41;</span>
&nbsp;
        title = wx.<span style="color: black;">StaticText</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, <span style="color: #ff4500;">-1</span>, title<span style="color: black;">&#41;</span>
        title.<span style="color: black;">SetFont</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">Font</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">18</span>, wx.<span style="color: black;">SWISS</span>, wx.<span style="color: black;">NORMAL</span>, wx.<span style="color: black;">BOLD</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        sizer.<span style="color: black;">Add</span><span style="color: black;">&#40;</span>title, <span style="color: #ff4500;">0</span>, wx.<span style="color: black;">ALIGN_CENTRE</span>|wx.<span style="color: black;">ALL</span>, <span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>
        sizer.<span style="color: black;">Add</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">StaticLine</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, <span style="color: #ff4500;">-1</span><span style="color: black;">&#41;</span>, <span style="color: #ff4500;">0</span>, wx.<span style="color: black;">EXPAND</span>|wx.<span style="color: black;">ALL</span>, <span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">########################################################################</span>
<span style="color: #ff7700;font-weight:bold;">class</span> UseAltBitmapPage<span style="color: black;">&#40;</span>wiz.<span style="color: black;">PyWizardPage</span><span style="color: black;">&#41;</span>:
&nbsp;
    <span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, parent, title<span style="color: black;">&#41;</span>:
        wiz.<span style="color: black;">PyWizardPage</span>.<span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, parent<span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">next</span> = <span style="color: #008000;">self</span>.<span style="color: black;">prev</span> = <span style="color: #008000;">None</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">sizer</span> = wx.<span style="color: black;">BoxSizer</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">VERTICAL</span><span style="color: black;">&#41;</span>
&nbsp;
        title = wx.<span style="color: black;">StaticText</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, label=title<span style="color: black;">&#41;</span>
        title.<span style="color: black;">SetFont</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">Font</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">18</span>, wx.<span style="color: black;">SWISS</span>, wx.<span style="color: black;">NORMAL</span>, wx.<span style="color: black;">BOLD</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">sizer</span>.<span style="color: black;">Add</span><span style="color: black;">&#40;</span>title<span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #008000;">self</span>.<span style="color: black;">sizer</span>.<span style="color: black;">Add</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">StaticText</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, <span style="color: #ff4500;">-1</span>, <span style="color: #483d8b;">&quot;This page uses a different bitmap&quot;</span><span style="color: black;">&#41;</span>,
                       <span style="color: #ff4500;">0</span>, wx.<span style="color: black;">ALL</span>, <span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">sizer</span>.<span style="color: black;">Layout</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> SetNext<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, next<span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">next</span> = next
&nbsp;
    <span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> SetPrev<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, prev<span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">prev</span> = prev
&nbsp;
    <span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> GetNext<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">next</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> GetPrev<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">prev</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> GetBitmap<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #808080; font-style: italic;"># You usually wouldn't need to override this method</span>
        <span style="color: #808080; font-style: italic;"># since you can set a non-default bitmap in the</span>
        <span style="color: #808080; font-style: italic;"># wxWizardPageSimple constructor, but if you need to</span>
        <span style="color: #808080; font-style: italic;"># dynamically change the bitmap based on the</span>
        <span style="color: #808080; font-style: italic;"># contents of the wizard, or need to also change the</span>
        <span style="color: #808080; font-style: italic;"># next/prev order then it can be done by overriding</span>
        <span style="color: #808080; font-style: italic;"># GetBitmap.</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> images.<span style="color: black;">WizTest2</span>.<span style="color: black;">GetBitmap</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
    wizard = wiz.<span style="color: black;">Wizard</span><span style="color: black;">&#40;</span><span style="color: #008000;">None</span>, <span style="color: #ff4500;">-1</span>, <span style="color: #483d8b;">&quot;Dynamic Wizard&quot;</span>,
                        images.<span style="color: black;">WizTest1</span>.<span style="color: black;">GetBitmap</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    page1 = TitledPage<span style="color: black;">&#40;</span>wizard, <span style="color: #483d8b;">&quot;Page 1&quot;</span><span style="color: black;">&#41;</span>
    page2 = TitledPage<span style="color: black;">&#40;</span>wizard, <span style="color: #483d8b;">&quot;Page 2&quot;</span><span style="color: black;">&#41;</span>
    page3 = TitledPage<span style="color: black;">&#40;</span>wizard, <span style="color: #483d8b;">&quot;Page 3&quot;</span><span style="color: black;">&#41;</span>
    page4 = UseAltBitmapPage<span style="color: black;">&#40;</span>wizard, <span style="color: #483d8b;">&quot;Page 4&quot;</span><span style="color: black;">&#41;</span>
    page5 = TitledPage<span style="color: black;">&#40;</span>wizard, <span style="color: #483d8b;">&quot;Page 5&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
    wizard.<span style="color: black;">FitToPage</span><span style="color: black;">&#40;</span>page1<span style="color: black;">&#41;</span>
    page5.<span style="color: black;">sizer</span>.<span style="color: black;">Add</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">StaticText</span><span style="color: black;">&#40;</span>page5, <span style="color: #ff4500;">-1</span>, <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>This is the last page.&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;"># Set the initial order of the pages</span>
    page1.<span style="color: black;">SetNext</span><span style="color: black;">&#40;</span>page2<span style="color: black;">&#41;</span>
    page2.<span style="color: black;">SetPrev</span><span style="color: black;">&#40;</span>page1<span style="color: black;">&#41;</span>
    page2.<span style="color: black;">SetNext</span><span style="color: black;">&#40;</span>page3<span style="color: black;">&#41;</span>
    page3.<span style="color: black;">SetPrev</span><span style="color: black;">&#40;</span>page2<span style="color: black;">&#41;</span>
    page3.<span style="color: black;">SetNext</span><span style="color: black;">&#40;</span>page4<span style="color: black;">&#41;</span>
    page4.<span style="color: black;">SetPrev</span><span style="color: black;">&#40;</span>page3<span style="color: black;">&#41;</span>
    page4.<span style="color: black;">SetNext</span><span style="color: black;">&#40;</span>page5<span style="color: black;">&#41;</span>
    page5.<span style="color: black;">SetPrev</span><span style="color: black;">&#40;</span>page4<span style="color: black;">&#41;</span>
&nbsp;
    wizard.<span style="color: black;">GetPageAreaSizer</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">Add</span><span style="color: black;">&#40;</span>page1<span style="color: black;">&#41;</span>
    wizard.<span style="color: black;">RunWizard</span><span style="color: black;">&#40;</span>page1<span style="color: black;">&#41;</span>
    wizard.<span style="color: black;">Destroy</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
    app = wx.<span style="color: black;">App</span><span style="color: black;">&#40;</span><span style="color: #008000;">False</span><span style="color: black;">&#41;</span>
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    app.<span style="color: black;">MainLoop</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre>
<p>This code starts out in much the same way as the previous code did. In this example, we also import an <strong>images </strong>module that contains a couple <strong>PyEmbeddedImage</strong> objects that we will use to demonstrate how to add bitmaps to our wizard page. Anyway, the first class is exactly the same as the previous one. Next we create a <strong>UseAltBitmapPage</strong> class that is a subclass of the <strong>PyWizardPage</strong>. We have to override a few methods to make it work correctly, but they&#8217;re pretty self-explanatory. This page will just be used to change the bitmap image of one page.</p>
<p>In the <strong>main</strong> function, we create a wizard in a slightly different way than we did previously:</p>
<pre class="python">wizard = wiz.<span style="color: black;">Wizard</span><span style="color: black;">&#40;</span><span style="color: #008000;">None</span>, <span style="color: #ff4500;">-1</span>, <span style="color: #483d8b;">&quot;Dynamic Wizard&quot;</span>, images.<span style="color: black;">WizTest1</span>.<span style="color: black;">GetBitmap</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre>
<p>As you can see, this method allows us to add a bitmap that will appear along the left hand side of the wizard pages. Anyway, after that, we create five pages with four of them being instances of the <strong>TitledPage</strong> and one being an instance of a <strong>UseAltBitmapPage</strong>. We fit the wizard to page one and then we see something odd:</p>
<pre class="python">page5.<span style="color: black;">sizer</span>.<span style="color: black;">Add</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">StaticText</span><span style="color: black;">&#40;</span>page5, <span style="color: #ff4500;">-1</span>, <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>This is the last page.&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre>
<p>What does that do? Well, it&#8217;s a silly way to append a widget to a page. To let the user know that they&#8217;ve reached the last page, we add a <strong>StaticText</strong> instance to it that explicitly tells that they have reached the end. The next few lines set up the order of the pages using <strong>SetNext </strong>and <strong>SetPrev</strong>. While these methods give you more granular control over the order of the pages, they&#8217;re not as convenient as the <strong>WizardPageSimple.Chain</strong> method. The last few lines of code are the same as the previous example.</p>
<h2>A Bonus Tip: How to Relabel the Wizard Buttons</h2>
<p>While creating this article, someone actually asked how to change the button labels of the wizard on the official <a href="http://groups.google.com/group/wxpython-users/browse_thread/thread/f5a96493a8202424?pli=1">wxPython mailing list</a>. So for completeness, we&#8217;ll take Robin Dunn&#8217;s solution and show how to change both the previous and the next button&#8217;s labels.</p>
<pre class="python">prev_btn = <span style="color: #008000;">self</span>.<span style="color: black;">FindWindowById</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">ID_BACKWARD</span><span style="color: black;">&#41;</span>
prev_btn.<span style="color: black;">SetLabel</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Foo&quot;</span><span style="color: black;">&#41;</span>
next_btn = <span style="color: #008000;">self</span>.<span style="color: black;">FindWindowById</span><span style="color: black;">&#40;</span>wx.<span style="color: black;">ID_FORWARD</span><span style="color: black;">&#41;</span>
next_btn.<span style="color: black;">SetLabel</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Bar&quot;</span><span style="color: black;">&#41;</span></pre>
<h2>Wrapping Up</h2>
<p>Now you know how to create the two types of wizards that are included with wxPython. You also have learned a fun hack to change the labels of the buttons in the wizard. Let me know if you think I forgot something and I&#8217;ll update the post or write a follow-up.</p>
<h2>Further Reading</h2>
<ul>
<li>wx.wizard.Wizard <a href="http://www.wxpython.org/docs/api/wx.wizard.Wizard-class.html">official documentation</a></li>
<li>wx.wizard.WizardPage <a href="http://www.wxpython.org/docs/api/wx.wizard.WizardPage-class.html">documentation</a></li>
<li>Andrea Gavana&#8217;s Wizard <a href="http://xoomer.virgilio.it/infinity77/wxPython/wizard/wx.wizard.Wizard.html">documentation</a></li>
</ul>
<h2>Source Code</h2>
<ul>
<li><a href='http://www.blog.pythonlibrary.org/wp-content/uploads/2011/01/wxWizards.zip'>wxWizards.zip</a></li>
<li><a href='http://www.blog.pythonlibrary.org/wp-content/uploads/2011/01/wxWizards.tar'>wxWizards.tar</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.pythonlibrary.org/2011/01/27/wxpython-a-wizard-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PyChecker: Python Code Analysis</title>
		<link>http://www.blog.pythonlibrary.org/2011/01/26/pychecker-python-code-analysis/</link>
		<comments>http://www.blog.pythonlibrary.org/2011/01/26/pychecker-python-code-analysis/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 02:42:41 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Cross-Platform]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[PyChecker]]></category>

		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=1572</guid>
		<description><![CDATA[PyChecker is a cool tool for checking Python scripts for bugs. It works with Python 2.0 &#8211; 2.7. In this article, we will write some crappy code to see what PyChecker can pick up on. Then we&#8217;ll improve the code according to what we find until the code checks out. According to PyChecker&#8217;s website, it [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://www.blog.pythonlibrary.org/2011/01/26/pychecker-python-code-analysis/" data-url="http://bit.ly/s82Xe8" data-text="PyChecker: Python Code Analysis" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://www.blog.pythonlibrary.org/2011/01/26/pychecker-python-code-analysis/&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>PyChecker is a cool tool for checking Python scripts for bugs. It works with Python 2.0 &#8211; 2.7. In this article, we will write some crappy code to see what PyChecker can pick up on. Then we&#8217;ll improve the code according to what we find until the code checks out. According to PyChecker&#8217;s <a href="http://pychecker.sourceforge.net/">website</a>, it can detect the following problems:</p>
<ul>
<li>No global found (e.g., using a module without importing it)</li>
<li>Passing the wrong number of parameters to functions/methods/constructors</li>
<li>Passing the wrong number of parameters to builtin functions &#038; methods</li>
<li>Using format strings that don&#8217;t match arguments</li>
<li>Using class methods and attributes that don&#8217;t exist</li>
<li>Changing signature when overriding a method</li>
<li>Redefining a function/class/method in the same scope</li>
<li>Using a variable before setting it</li>
<li>self is not the first parameter defined for a method</li>
<li>Unused globals and locals (module or variable)</li>
<li>Unused function/method arguments (can ignore self)</li>
<li>No doc strings in modules, classes, functions, and methods </li>
</ul>
<p><span id="more-1572"></span></p>
<h2>Getting Started</h2>
<p>We won&#8217;t test everything that it can detect, but we can make some pretty messy code for PyChecker to check. Let&#8217;s start coding!</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
<span style="color: #808080; font-style: italic;">########################################################################</span>
<span style="color: #ff7700;font-weight:bold;">class</span> CarClass:
    <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, color, make, model, year<span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;Constructor&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">color</span> = color
        <span style="color: #008000;">self</span>.<span style="color: black;">make</span> = make
        <span style="color: #008000;">self</span>.<span style="color: black;">model</span> = model
        <span style="color: #008000;">self</span>.<span style="color: black;">year</span> = year
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #483d8b;">&quot;Windows&quot;</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">platform</span>.<span style="color: #dc143c;">platform</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;You're using Windows!&quot;</span>
&nbsp;
        <span style="color: #008000;">self</span>.<span style="color: black;">weight</span> = <span style="color: #008000;">self</span>.<span style="color: black;">getWeight</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">2</span>, <span style="color: #ff4500;">3</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#----------------------------------------------------------------------</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> getWeight<span style="color: black;">&#40;</span>this<span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">&quot;2000 lbs&quot;</span></pre>
<p>This code doesn&#8217;t really do much of anything and is only for illustration purposes. According to PyChecker, there are four problems with this code. Can you see the issues? If not, then let&#8217;s find out how to use PyChecker to expose them! Once you have installed PyChecker and put it on your path (see PyChecker&#8217;s documentation), you should be able to do the following command:</p>
<p><code><br />
C:\Users\Mike\Documents\My Dropbox\Scripts\code analysis&gt;pychecker bad.py<br />
</code></p>
<p><em>Note: The above only works if you have pychecker on your system path on Windows. Technically, on Windows you will be using pychecker.bat</em></p>
<p>If you do this, you&#8217;ll end up with something like the following:</p>
<p><a href="http://www.blog.pythonlibrary.org/wp-content/uploads/2011/01/pychecker_output.png"><img src="http://www.blog.pythonlibrary.org/wp-content/uploads/2011/01/pychecker_output.png" alt="" title="pychecker_output" width="500" height="243" class="aligncenter size-full wp-image-1574" /></a></p>
<p>Hopefully you can tell what that all means, but we&#8217;ll break it down just in case you don&#8217;t. There are four problems that it has identified. The first issue it found is that we import the <strong>sys</strong> module, but we don&#8217;t use it. The second issue is the opposite of the first. We refer to the <strong>platform</strong> module, but it&#8217;s not actually imported! Thirdly, we call our <strong>getWeight</strong> method and it reports that we passed it too many parameters. I think PyChecker may have a bug here as our method should accept one method, not zero. The &#8220;this&#8221; parameter must confuse PyChecker. Fortunately, the last problem it finds is that getWeight doesn&#8217;t have <strong>self </strong>as the first parameter. This kind of rectifies the bug I mentioned. While the first method doesn&#8217;t require us to name it &#8220;self&#8221;,  that is the normal naming convention for the first parameter in a class method.</p>
<h2>Other Tips</h2>
<p>PyChecker doesn&#8217;t just work on the command line. You can also use it directly in your code! All you have to do is import PyChecker at the top of your module, like this:</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> pychecker.<span style="color: black;">checker</span></pre>
<p>This will make PyChecker check all the following imported modules, although it won&#8217;t do the main module. What does that mean? It means that if you stick that line in the example we used, you won&#8217;t see any errors related to that code. The PyChecker documentation says that you can also set PyChecker&#8217;s option via os.environ. Here&#8217;s an example:</p>
<pre class="python"><span style="color: #dc143c;">os</span>.<span style="color: black;">environ</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'PYCHECKER'</span><span style="color: black;">&#93;</span> = <span style="color: #483d8b;">'command line options here'</span></pre>
<p>Speaking of which, here are the common command line options:</p>
<p>
<table id="wp-table-reloaded-id-2-no-1" class="wp-table-reloaded wp-table-reloaded-id-2">
<thead>
	<tr class="row-1 odd">
		<th class="column-1">Options</th><th class="column-2">Description</th><th class="column-3">Default</th>
	</tr>
</thead>
<tbody>
	<tr class="row-2 even">
		<td class="column-1">--only</td><td class="column-2">only warn about files passed on the command line</td><td class="column-3">no</td>
	</tr>
	<tr class="row-3 odd">
		<td class="column-1">-#, --limit</td><td class="column-2">the maximum number of warnings to be displayed 	</td><td class="column-3">10</td>
	</tr>
	<tr class="row-4 even">
		<td class="column-1">--no-shadowbuiltin</td><td class="column-2">check if a variable shadows a builtin</td><td class="column-3">off</td>
	</tr>
	<tr class="row-5 odd">
		<td class="column-1">-q, --stdlib</td><td class="column-2">ignore warnings from files under standard library</td><td class="column-3">off</td>
	</tr>
	<tr class="row-6 even">
		<td class="column-1">-T, --argsused</td><td class="column-2">unused method/function arguments</td><td class="column-3">on</td>
	</tr>
</tbody>
</table>
</p>
<p>If you&#8217;d like a full list of commands, type the following: pychecker -h</p>
<p><em>NOTE: PyChecker&#8217;s docstring checking is off by default, so if you want it you need to pass the &#8220;-m -f&#8221; commands. This only found the class module&#8217;s empty docstring. There seems to be a minor bug with &#8220;-f&#8221; in which it thinks empty doc strings are ok. I have alerted the PyChecker team to that.</em></p>
<h2>Wrapping Up</h2>
<p>I think PyChecker is pretty cool and it looks like it could be a handy tool. Give it a try and see what you think!</p>
<h2>Additional Reading</h2>
<ul>
<li>PyChecker official <a href="http://pychecker.sourceforge.net/">website</a></li>
<li><a href="http://www.logilab.org/857">PyLint </a>- another project that&#8217;s in the same vein as PyChecker</li>
<li><a href="http://pypi.python.org/pypi/pyflakes">pyflakes</a> &#8211; another similar project</li>
<li>Doug Hellman&#8217;s <a href="http://www.doughellmann.com/articles/pythonmagazine/completely-different/2008-03-linters/index.html">review </a>of Python Static Code Analyzers from the Python Magazine</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.pythonlibrary.org/2011/01/26/pychecker-python-code-analysis/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 4.343 seconds -->

