<?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: Default paramater values with python</title>
	<atom:link href="http://drakonen.com/2008/default-paramater-values-with-python/feed/" rel="self" type="application/rss+xml" />
	<link>http://drakonen.com/2008/default-paramater-values-with-python/</link>
	<description>Here be Dragons  -  Drakonen&#039;s Blog</description>
	<lastBuildDate>Mon, 23 Jan 2012 12:35:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: JK</title>
		<link>http://drakonen.com/2008/default-paramater-values-with-python/comment-page-1/#comment-3427</link>
		<dc:creator>JK</dc:creator>
		<pubDate>Tue, 21 Apr 2009 14:19:33 +0000</pubDate>
		<guid isPermaLink="false">http://drakonen.com/blog/?p=78#comment-3427</guid>
		<description>You should really use the faster `is` to compare against `None`:

  if time is None:
    do_stuff()</description>
		<content:encoded><![CDATA[<p>You should really use the faster `is` to compare against `None`:</p>
<p>  if time is None:<br />
    do_stuff()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maze</title>
		<link>http://drakonen.com/2008/default-paramater-values-with-python/comment-page-1/#comment-3408</link>
		<dc:creator>maze</dc:creator>
		<pubDate>Fri, 26 Sep 2008 11:08:43 +0000</pubDate>
		<guid isPermaLink="false">http://drakonen.com/blog/?p=78#comment-3408</guid>
		<description>Personally, I like patterns like:


def bar(time=None):
    time = time or datetime.now()


Also, for dictionary items/default parameters, you can use:


defaults = {
    &#039;verbose&#039;: True,
    &#039;quickfox&#039;: 42,
}

def bar(**options):
    settings = defaults
    settings.update(options)

bar(quickfox=23)


Just my piece of mind</description>
		<content:encoded><![CDATA[<p>Personally, I like patterns like:</p>
<p>def bar(time=None):<br />
    time = time or datetime.now()</p>
<p>Also, for dictionary items/default parameters, you can use:</p>
<p>defaults = {<br />
    &#8216;verbose&#8217;: True,<br />
    &#8216;quickfox&#8217;: 42,<br />
}</p>
<p>def bar(**options):<br />
    settings = defaults<br />
    settings.update(options)</p>
<p>bar(quickfox=23)</p>
<p>Just my piece of mind</p>
]]></content:encoded>
	</item>
</channel>
</rss>

