<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>Diego, el gnomo &#187; python</title>
	<atom:link href="http://blogs.gnome.org/diegoe/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.gnome.org/diegoe</link>
	<description>Pisco Sour is GNOME's official cocktail</description>
	<lastBuildDate>Wed, 21 Oct 2009 01:15:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/pe/</creativeCommons:license>		<item>
		<title>Python common mistakes</title>
		<link>http://blogs.gnome.org/diegoe/2009/05/23/python-common-mistakes/</link>
		<comments>http://blogs.gnome.org/diegoe/2009/05/23/python-common-mistakes/#comments</comments>
		<pubDate>Sat, 23 May 2009 19:09:58 +0000</pubDate>
		<dc:creator>diegoe</dc:creator>
				<category><![CDATA[planetdebian]]></category>
		<category><![CDATA[planetgnome]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[faq]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/diegoe/?p=127</guid>
		<description><![CDATA[When starting with Python or just when you haven&#8217;t read PEP 8 you usually fall into some frequent mistakes. Mostly because you take your experience in other languages to Python and your mind gets confused with the new conventions (or something like that).
Some of these errors and their explanation:

if a == None:
Really common. None is [...]]]></description>
			<content:encoded><![CDATA[<p>When starting with Python or just when you haven&#8217;t read <a href="http://www.python.org/dev/peps/pep-0008/">PEP 8</a> you usually fall into some frequent mistakes. Mostly because you take your experience in other languages to Python and your mind gets confused with the new conventions (or something like that).</p>
<p>Some of these errors and their explanation:</p>
<ul>
<li><strong>if a == None:</strong><br />
Really common. None is a singleton, so you can (well, actually, have) to compare to it like &#8216;<strong>if a is None</strong>&#8216; or &#8216;<strong>if a is not None</strong>&#8216;.</li>
<li><strong>if (condition):</strong><br />
This is not really pythonic, if doesn&#8217;t take () around the condition in python, () purpose is grouping, you can use them in an if but only to clarify a really complex condition or similar stuff. Please don&#8217;t clutter code with unneeded characters.</li>
<li><strong>if len(list):<br />
</strong>This is a misunderstanding of Python way of things, any empty sequence (string, list, tuple) is False. So if you want to make sure a list is empty, just check if it&#8217;s False. Same for tuples, and in some ocassions for strings.</li>
<li><strong>if type(obj) is type(1):<br />
</strong>This is killing kittens, there&#8217;s a builtin function for this purpose, it&#8217;s called -surprise- isinstance(object, type). For example <strong>isinstance(123, int)</strong></li>
</ul>
<p>Read more about this and other conventions in <a href="http://www.python.org/dev/peps/pep-0008/">PEP 8</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/diegoe/2009/05/23/python-common-mistakes/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
