<?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"
	>
<channel>
	<title>Comments on: ROT13 in Python</title>
	<atom:link href="http://boredzo.org/blog/archives/2007-01-31/rot13-in-python/feed" rel="self" type="application/rss+xml" />
	<link>http://boredzo.org/blog/archives/2007-01-31/rot13-in-python</link>
	<description>The personal weblog of Peter Hosey.</description>
	<pubDate>Wed, 07 Jan 2009 04:26:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: Matt</title>
		<link>http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-7062</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Fri, 02 Feb 2007 20:00:35 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-7062</guid>
		<description>#!/bin/sh
echo $1 &#124; tr A-Za-z N-ZA-Mn-za-m</description>
		<content:encoded><![CDATA[<p>#!/bin/sh<br />
echo $1 | tr A-Za-z N-ZA-Mn-za-m</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-6946</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Thu, 01 Feb 2007 02:39:06 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-6946</guid>
		<description>It's even shorter in vim: g?G</description>
		<content:encoded><![CDATA[<p>It's even shorter in vim: g?G</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Hosey</title>
		<link>http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-6941</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Wed, 31 Jan 2007 23:56:58 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-6941</guid>
		<description>[quote="Dan H"]If you want a command line script, is there a better way to handle the input argument than this?

data_to_rot13 = str(sys.argv[1:])[/quote]

First, &lt;code&gt;str(some_list)&lt;/code&gt; applied to a list will get you the repr of it:

&lt;blockquote&gt;&#62;&#62;&#62; str(['a', 'b'])
"['a', 'b']"&lt;/blockquote&gt;

The correct way is ' '.join.

Even so, I generally use optparse for such things, even if I'm not going to have options, unless it's a one-off script that I don't care about.

&lt;blockquote&gt;import optparse
parser = optparse.OptionParser(usage='%p "Hello, my name is Bob!"')
opts, args = parser.parse_args()
data_to_rot13 = ' '.join(args)&lt;/blockquote&gt;

The advantage of this is that I can easily add options later.

[quote]Also, this live preview thing is neat. Is that a plugin?[/quote]

Aye. It's called &lt;a href="http://dev.wp-plugins.org/wiki/LiveCommentPreview" rel="nofollow"&gt;Live Comment Preview&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<blockquote cite="http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-"><p>
If you want a command line script, is there a better way to handle the input argument than this?</p>
<p>data_to_rot13 = str(sys.argv[1:])</p>
</blockquote>
<p>First, <code>str(some_list)</code> applied to a list will get you the repr of it:</p>
<blockquote cite="http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-"><p>&gt;&gt;&gt; str(['a', 'b'])<br />
"['a', 'b']"</p>
</blockquote>
<p>The correct way is ' '.join.</p>
<p>Even so, I generally use optparse for such things, even if I'm not going to have options, unless it's a one-off script that I don't care about.</p>
<blockquote cite="http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-"><p>import optparse<br />
parser = optparse.OptionParser(usage='%p "Hello, my name is Bob!"')<br />
opts, args = parser.parse_args()<br />
data_to_rot13 = ' '.join(args)</p>
</blockquote>
<p>The advantage of this is that I can easily add options later.</p>
<blockquote cite="http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-"><p>
Also, this live preview thing is neat. Is that a plugin?</p>
</blockquote>
<p>Aye. It's called <a href="http://dev.wp-plugins.org/wiki/LiveCommentPreview" rel="nofollow">Live Comment Preview</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie</title>
		<link>http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-6927</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Wed, 31 Jan 2007 19:47:23 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-6927</guid>
		<description>Python rocks my friend...thanks for convincing me.  Used SWIG for the first time in the last few days...check it out.</description>
		<content:encoded><![CDATA[<p>Python rocks my friend...thanks for convincing me.  Used SWIG for the first time in the last few days...check it out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan H</title>
		<link>http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-6921</link>
		<dc:creator>Dan H</dc:creator>
		<pubDate>Wed, 31 Jan 2007 17:26:25 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-01-31/rot13-in-python#comment-6921</guid>
		<description>If you want a command line script, is there a better way to handle the input argument than this?

#! /usr/bin/python
# Usage:
# rot13.py 'Hello, my name is Bob!'
import sys
import codecs
data_to_rot13 = str(sys.argv[1:])
rot13ed_data = codecs.getencoder('rot13')(data_to_rot13)[0]
print rot13ed_data

Also, this live preview thing is neat.  Is that a plugin?</description>
		<content:encoded><![CDATA[<p>If you want a command line script, is there a better way to handle the input argument than this?</p>
<p>#! /usr/bin/python<br />
# Usage:<br />
# rot13.py 'Hello, my name is Bob!'<br />
import sys<br />
import codecs<br />
data_to_rot13 = str(sys.argv[1:])<br />
rot13ed_data = codecs.getencoder('rot13')(data_to_rot13)[0]<br />
print rot13ed_data</p>
<p>Also, this live preview thing is neat.  Is that a plugin?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

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