<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Python for Pinocchio</title>
	<atom:link href="http://sjcuthbertson.wordpress.com/2009/09/05/python-for-pinocchio/feed/" rel="self" type="application/rss+xml" />
	<link>http://sjcuthbertson.wordpress.com/2009/09/05/python-for-pinocchio/</link>
	<description>Philosophy, cookery and geekery</description>
	<lastBuildDate>Tue, 19 Jan 2010 20:30:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Stuart</title>
		<link>http://sjcuthbertson.wordpress.com/2009/09/05/python-for-pinocchio/#comment-104</link>
		<dc:creator><![CDATA[Stuart]]></dc:creator>
		<pubDate>Tue, 19 Jan 2010 20:30:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.sjcuthbertson.me.uk/?p=225#comment-104</guid>
		<description><![CDATA[Indeed, I remember finding that out a couple of years back, in The Bar, I think.  However I notice now he&#039;s not mentioned at all on the site, whilst three other blokes are...? All part of the lie?

When I said I found out &quot;a while ago&quot; - I did originally discover it yonks back, forgot, remembered whilst talking to Ian, forgot, and discovered it again a month before this blog post.

May do an updated version someday, especially if a simple API was created... though currently working on a rather more complex python app that finds optimal arrangements of &quot;items&quot; that have preferences on which other &quot;items&quot; they&#039;re near, for a given configuration of &quot;slots&quot; that these &quot;items&quot; can be placed in.  Savvy? :)]]></description>
		<content:encoded><![CDATA[<p>Indeed, I remember finding that out a couple of years back, in The Bar, I think.  However I notice now he&#8217;s not mentioned at all on the site, whilst three other blokes are&#8230;? All part of the lie?</p>
<p>When I said I found out &#8220;a while ago&#8221; &#8211; I did originally discover it yonks back, forgot, remembered whilst talking to Ian, forgot, and discovered it again a month before this blog post.</p>
<p>May do an updated version someday, especially if a simple API was created&#8230; though currently working on a rather more complex python app that finds optimal arrangements of &#8220;items&#8221; that have preferences on which other &#8220;items&#8221; they&#8217;re near, for a given configuration of &#8220;slots&#8221; that these &#8220;items&#8221; can be placed in.  Savvy? <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Ashby</title>
		<link>http://sjcuthbertson.wordpress.com/2009/09/05/python-for-pinocchio/#comment-103</link>
		<dc:creator><![CDATA[Christian Ashby]]></dc:creator>
		<pubDate>Tue, 19 Jan 2010 08:56:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.sjcuthbertson.me.uk/?p=225#comment-103</guid>
		<description><![CDATA[I happen to live with the man who wrote DWOL, so he can probably provide an API, but still, it was a learning process, right?]]></description>
		<content:encoded><![CDATA[<p>I happen to live with the man who wrote DWOL, so he can probably provide an API, but still, it was a learning process, right?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart</title>
		<link>http://sjcuthbertson.wordpress.com/2009/09/05/python-for-pinocchio/#comment-102</link>
		<dc:creator><![CDATA[Stuart]]></dc:creator>
		<pubDate>Sun, 06 Sep 2009 08:38:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.sjcuthbertson.me.uk/?p=225#comment-102</guid>
		<description><![CDATA[Thank you :) I&#039;m well aware that the line numbers are technically fragile (though in the case of DWOL it&#039;s very unlikely there&#039;ll ever be a redesign), but the regexps were a large part of why I wanted to write the thing in the first place! :) I&#039;ll have a look at etree nonetheless, but for this instance, the coding was to teach me something specific (ish) rather than to learn a new library.

I think a flag is actually easier, given that there&#039;s only really one that matters (-d).  -r is there for completeness but it defaults to a random lie anyway.  I&#039;ve always preferred these to the longer-hand form that apt/bzr/etc use.]]></description>
		<content:encoded><![CDATA[<p>Thank you <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I&#8217;m well aware that the line numbers are technically fragile (though in the case of DWOL it&#8217;s very unlikely there&#8217;ll ever be a redesign), but the regexps were a large part of why I wanted to write the thing in the first place! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I&#8217;ll have a look at etree nonetheless, but for this instance, the coding was to teach me something specific (ish) rather than to learn a new library.</p>
<p>I think a flag is actually easier, given that there&#8217;s only really one that matters (-d).  -r is there for completeness but it defaults to a random lie anyway.  I&#8217;ve always preferred these to the longer-hand form that apt/bzr/etc use.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Laban</title>
		<link>http://sjcuthbertson.wordpress.com/2009/09/05/python-for-pinocchio/#comment-101</link>
		<dc:creator><![CDATA[David Laban]]></dc:creator>
		<pubDate>Sat, 05 Sep 2009 16:57:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.sjcuthbertson.me.uk/?p=225#comment-101</guid>
		<description><![CDATA[Thought I&#039;d give you a few comments:

1) It&#039;s best to write python scripts like C, with a main() function, and then put

if __name__ == &quot;__main__&quot;:
    main(*sys.argv[1:])

at the bottom. This makes it feel more like a program than a hacky script (even though it&#039;s no more effort), and encourages you to write it in a clean, readable top-down style.

2) If it&#039;s xml/xhtml, then try using xml.etree.ElementTree.parse() (etree&#039;s API is a lot nicer than DOM) or something. Rexexps and hard-coded line numbers are fragile.

3) Try using &quot;if &#039;-r&#039; in sys.argv:&quot; if a flag is really what you want. single-letter flags are very old-style unix though. I&#039;m not going to recommend optparse for this because it&#039;s overkill, but maybe an aptitude/svn/bzr-style subcommand (like $ tellalie.py random or $ tellalie.py daily) might be more appropriate in this day and age.

4) Please Please Please read pep8: http://www.python.org/dev/peps/pep-0008/. Style is very important, especially if you&#039;re ever thinking of reading your code in the future. Obvious thing include comments in the wrong place and multiple imports on the same line.

5) It is currently recommended that you write API-compatible 2.6 versions of any python3 modules you write (so i&#039;d be surprised if urllib/urllib2 didn&#039;t have some backwards compatible functions. In the worst case, you can wrap your imports in try/catch). If you want to &quot;from __future__ import print_function&quot; then that&#039;s cool too.]]></description>
		<content:encoded><![CDATA[<p>Thought I&#8217;d give you a few comments:</p>
<p>1) It&#8217;s best to write python scripts like C, with a main() function, and then put</p>
<p>if __name__ == &#8220;__main__&#8221;:<br />
    main(*sys.argv[1:])</p>
<p>at the bottom. This makes it feel more like a program than a hacky script (even though it&#8217;s no more effort), and encourages you to write it in a clean, readable top-down style.</p>
<p>2) If it&#8217;s xml/xhtml, then try using xml.etree.ElementTree.parse() (etree&#8217;s API is a lot nicer than DOM) or something. Rexexps and hard-coded line numbers are fragile.</p>
<p>3) Try using &#8220;if &#8216;-r&#8217; in sys.argv:&#8221; if a flag is really what you want. single-letter flags are very old-style unix though. I&#8217;m not going to recommend optparse for this because it&#8217;s overkill, but maybe an aptitude/svn/bzr-style subcommand (like $ tellalie.py random or $ tellalie.py daily) might be more appropriate in this day and age.</p>
<p>4) Please Please Please read pep8: <a href="http://www.python.org/dev/peps/pep-0008/" rel="nofollow">http://www.python.org/dev/peps/pep-0008/</a>. Style is very important, especially if you&#8217;re ever thinking of reading your code in the future. Obvious thing include comments in the wrong place and multiple imports on the same line.</p>
<p>5) It is currently recommended that you write API-compatible 2.6 versions of any python3 modules you write (so i&#8217;d be surprised if urllib/urllib2 didn&#8217;t have some backwards compatible functions. In the worst case, you can wrap your imports in try/catch). If you want to &#8220;from __future__ import print_function&#8221; then that&#8217;s cool too.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

