<?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: From Java to Python</title>
	<atom:link href="http://noopenblockers.com/2010/01/13/from-java-to-python/feed/" rel="self" type="application/rss+xml" />
	<link>http://noopenblockers.com/2010/01/13/from-java-to-python/</link>
	<description></description>
	<lastBuildDate>Fri, 04 Jun 2010 17:10:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jay</title>
		<link>http://noopenblockers.com/2010/01/13/from-java-to-python/comment-page-1/#comment-1069</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Fri, 15 Jan 2010 13:44:56 +0000</pubDate>
		<guid isPermaLink="false">http://noopenblockers.com/?p=851#comment-1069</guid>
		<description>Wow, you weren&#039;t kidding. I&#039;ve only dorked with the JSON implementation so far, but it&#039;s crazy easy.

simplejson.load(file(&#039;name&#039;))

That ROCKS.</description>
		<content:encoded><![CDATA[<p>Wow, you weren&#8217;t kidding. I&#8217;ve only dorked with the JSON implementation so far, but it&#8217;s crazy easy.</p>
<p>simplejson.load(file(&#8216;name&#8217;))</p>
<p>That ROCKS.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael DeHaan</title>
		<link>http://noopenblockers.com/2010/01/13/from-java-to-python/comment-page-1/#comment-1065</link>
		<dc:creator>Michael DeHaan</dc:creator>
		<pubDate>Thu, 14 Jan 2010 00:33:35 +0000</pubDate>
		<guid isPermaLink="false">http://noopenblockers.com/?p=851#comment-1065</guid>
		<description>Keith -- then if you look at Ruby, and see how much better blocks and generators are there.

Jens -- I really thought it used to auto detect when I was using it.   Perhaps this is newness.

Anyway, JSON is about 200x faster than Yaml in python, C library or no, because it doesn&#039;t have to deal with ambiguity and the lexer (or what have you) is therefore much much simpler.  

Simplejson on the other hand is somewhat stupid about converting things to unicode when you don&#039;t expect it, so get used to checking isinstance(foo, basestr) versus seeing if something is a string, etc.

As you can tell, I spent WAAAAY too much time with serializers in Cobbler-timeframe.</description>
		<content:encoded><![CDATA[<p>Keith &#8212; then if you look at Ruby, and see how much better blocks and generators are there.</p>
<p>Jens &#8212; I really thought it used to auto detect when I was using it.   Perhaps this is newness.</p>
<p>Anyway, JSON is about 200x faster than Yaml in python, C library or no, because it doesn&#8217;t have to deal with ambiguity and the lexer (or what have you) is therefore much much simpler.  </p>
<p>Simplejson on the other hand is somewhat stupid about converting things to unicode when you don&#8217;t expect it, so get used to checking isinstance(foo, basestr) versus seeing if something is a string, etc.</p>
<p>As you can tell, I spent WAAAAY too much time with serializers in Cobbler-timeframe.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith</title>
		<link>http://noopenblockers.com/2010/01/13/from-java-to-python/comment-page-1/#comment-1063</link>
		<dc:creator>Keith</dc:creator>
		<pubDate>Wed, 13 Jan 2010 20:20:22 +0000</pubDate>
		<guid isPermaLink="false">http://noopenblockers.com/?p=851#comment-1063</guid>
		<description>range()?!?!?

no, no, no, no, no, if you&#039;re going to do a numeric loop, you want xrange()

and you&#039;ll start to wonder why they&#039;re different, and you&#039;ll start learning about generators, and realize that Python is really freaking awesome :-)</description>
		<content:encoded><![CDATA[<p>range()?!?!?</p>
<p>no, no, no, no, no, if you&#8217;re going to do a numeric loop, you want xrange()</p>
<p>and you&#8217;ll start to wonder why they&#8217;re different, and you&#8217;ll start learning about generators, and realize that Python is really freaking awesome <img src='http://noopenblockers.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://noopenblockers.com/2010/01/13/from-java-to-python/comment-page-1/#comment-1062</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Wed, 13 Jan 2010 19:29:05 +0000</pubDate>
		<guid isPermaLink="false">http://noopenblockers.com/?p=851#comment-1062</guid>
		<description>Awesome feedback on the config stuff, I really appreciate it. This is exactly why I posted about this stuff.

Thankfully, all of my code so far has largely just been learning, so I haven&#039;t unleashed any massive configuration-related security holes.  :)</description>
		<content:encoded><![CDATA[<p>Awesome feedback on the config stuff, I really appreciate it. This is exactly why I posted about this stuff.</p>
<p>Thankfully, all of my code so far has largely just been learning, so I haven&#8217;t unleashed any massive configuration-related security holes.  <img src='http://noopenblockers.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens Knutson</title>
		<link>http://noopenblockers.com/2010/01/13/from-java-to-python/comment-page-1/#comment-1061</link>
		<dc:creator>Jens Knutson</dc:creator>
		<pubDate>Wed, 13 Jan 2010 19:15:36 +0000</pubDate>
		<guid isPermaLink="false">http://noopenblockers.com/?p=851#comment-1061</guid>
		<description>Michael&#039;s right about not using Python for config files.  I personally find YAML considerably more readable, and far more useful for some tasks.  That said, YAML can get a bit slow if you start building large or very files with it.

If you do play with YAML, make sure you install the &#039;libyaml&#039; package in addition to PyYAML.  Then, to get PyYAML&#039;s to actually reap the speed boost from libyaml, you have to specify using it in the the .load() and .dump() methods, like this:

yaml.dump(data, Dumper=yaml.CDumper)
yaml.load(yaml_file, Loader=yaml.CLoader)

(Why the hell it can&#039;t just f#$&amp;ing autodetect is beyond me, but whatever.)

Hope that helps!</description>
		<content:encoded><![CDATA[<p>Michael&#8217;s right about not using Python for config files.  I personally find YAML considerably more readable, and far more useful for some tasks.  That said, YAML can get a bit slow if you start building large or very files with it.</p>
<p>If you do play with YAML, make sure you install the &#8216;libyaml&#8217; package in addition to PyYAML.  Then, to get PyYAML&#8217;s to actually reap the speed boost from libyaml, you have to specify using it in the the .load() and .dump() methods, like this:</p>
<p>yaml.dump(data, Dumper=yaml.CDumper)<br />
yaml.load(yaml_file, Loader=yaml.CLoader)</p>
<p>(Why the hell it can&#8217;t just f#$&amp;ing autodetect is beyond me, but whatever.)</p>
<p>Hope that helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael DeHaan</title>
		<link>http://noopenblockers.com/2010/01/13/from-java-to-python/comment-page-1/#comment-1059</link>
		<dc:creator>Michael DeHaan</dc:creator>
		<pubDate>Wed, 13 Jan 2010 16:29:33 +0000</pubDate>
		<guid isPermaLink="false">http://noopenblockers.com/?p=851#comment-1059</guid>
		<description>FWIW, I call them methods.

I also refuse to call &#039;dict&#039; anything but &#039;hash&#039;.</description>
		<content:encoded><![CDATA[<p>FWIW, I call them methods.</p>
<p>I also refuse to call &#8216;dict&#8217; anything but &#8216;hash&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael DeHaan</title>
		<link>http://noopenblockers.com/2010/01/13/from-java-to-python/comment-page-1/#comment-1058</link>
		<dc:creator>Michael DeHaan</dc:creator>
		<pubDate>Wed, 13 Jan 2010 16:28:36 +0000</pubDate>
		<guid isPermaLink="false">http://noopenblockers.com/?p=851#comment-1058</guid>
		<description>Re: &quot;Depending on what you’re doing, you can likely just stuff configuration values into a script and import it (not needing to compile really is liberating in this respect). That’ll also give you the use of lists and maps by default.&quot;

Don&#039;t do this, as it is a potential security hole.  A much more awesome trick is using either yaml or simplejson and doing simplejson.loads() or yaml.loads(), etc.  If you need INI style files, use ConfigParser (which doesn&#039;t have said collections), but in cases where you are happy with a module, just go the extra step and use simplejson or YAML and you are home free.

I find yaml is /slightly/ better for human readable files, but it is slower.</description>
		<content:encoded><![CDATA[<p>Re: &#8220;Depending on what you’re doing, you can likely just stuff configuration values into a script and import it (not needing to compile really is liberating in this respect). That’ll also give you the use of lists and maps by default.&#8221;</p>
<p>Don&#8217;t do this, as it is a potential security hole.  A much more awesome trick is using either yaml or simplejson and doing simplejson.loads() or yaml.loads(), etc.  If you need INI style files, use ConfigParser (which doesn&#8217;t have said collections), but in cases where you are happy with a module, just go the extra step and use simplejson or YAML and you are home free.</p>
<p>I find yaml is /slightly/ better for human readable files, but it is slower.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
