<?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/"
	>

<channel>
	<title>Mike&#039;s Blabberings &#187; humor</title>
	<atom:link href="http://www.mike-griffith.com/blog/tag/humor/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mike-griffith.com/blog</link>
	<description>on software, testing, and the web.</description>
	<lastBuildDate>Mon, 14 Feb 2011 10:51:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>I used to play sports. Then I realized you can buy trophies. Now I’m good at everything.</title>
		<link>http://www.mike-griffith.com/blog/2009/02/i-used-to-play-sports-then-i-realized-you-can-buy-trophies-now-i%e2%80%99m-good-at-everything/</link>
		<comments>http://www.mike-griffith.com/blog/2009/02/i-used-to-play-sports-then-i-realized-you-can-buy-trophies-now-i%e2%80%99m-good-at-everything/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 16:50:20 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[off topic]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.mike-griffith.com/blog/?p=265</guid>
		<description><![CDATA[I stumbled across &#8220;Dammit I&#8217;m Mad&#8221; by Demetri Martin, a rumored-to-be 224 word palindrome poem.  
I was impressed, but needed to check the accuracy of such a statement.  So I dialed up a python session.

import re
awesomedrome = &#34;&#34;&#34;Dammit I'm mad.
Evil is a deed as I live.
God, am I reviled? I rise, my bed [...]]]></description>
			<content:encoded><![CDATA[<p>I stumbled across <a href="http://www.slate.com/id/2101150/sidebar/2101387/ent/2101353/">&#8220;Dammit I&#8217;m Mad&#8221; by Demetri Martin</a>, a rumored-to-be 224 word palindrome poem.  </p>
<p>I was impressed, but needed to check the accuracy of such a statement.  So I dialed up a python session.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
awesomedrome = <span style="color: #483d8b;">&quot;&quot;&quot;Dammit I'm mad.
Evil is a deed as I live.
God, am I reviled? I rise, my bed on a sun, I melt.
To be not one man emanating is sad. I piss.
Alas, it is so late. Who stops to help?
Man, it is hot. I'm in it. I tell.
I am not a devil. I level &quot;Mad Dog&quot;.
Ah, say burning is, as a deified gulp,
In my halo of a mired rum tin.
I erase many men. Oh, to be man, a sin.
Is evil in a clam? In a trap?
No. It is open. On it I was stuck.
Rats peed on hope. Elsewhere dips a web.
Be still if I fill its ebb.
Ew, a spider... eh?
We sleep. Oh no!
Deep, stark cuts saw it in one position.
Part animal, can I live? Sin is a name.
Both, one... my names are in it.
Murder? I'm a fool.
A hymn I plug, deified as a sign in ruby ash,
A Goddam level I lived at.
On mail let it in. I'm it.
Oh, sit in ample hot spots. Oh wet!
A loss it is alas (sip). I'd assign it a name.
Name not one bottle minus an ode by me:
&quot;Sir, I deliver. I'm a dog&quot;
Evil is a deed as I live.
Dammit I'm mad.&quot;&quot;&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># strip out all punctuation</span>
just_the_chars = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\W</span>'</span><span style="color: black;">&#41;</span>.<span style="color: black;">sub</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span>, awesomedrome<span style="color: black;">&#41;</span>.<span style="color: black;">lower</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> test_palindrome<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #808080; font-style: italic;"># chars[::-1] gives the reverse of the resulting string</span>
    <span style="color: #ff7700;font-weight:bold;">assert</span> just_the_chars == just_the_chars<span style="color: black;">&#91;</span>::-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span></pre></div></div>

<p>I stripped out any non-word characters (punctuation, space, etc) with the regular expression, lower-cased it all, and compared it front to back.</p>
<p><del datetime="2010-04-22T14:28:25+00:00"></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ python is_demtri_a_god.py
not exactly</pre></div></div>

<p>As you can see, it&#8217;s not palindromic.</p>
<p>So close.</del></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ nosetests test_demetri.py
.
<span style="color: #660033;">----------------------------------------------------------------------</span>
Ran <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #000000; font-weight: bold;">in</span> 0.001s
&nbsp;
OK</pre></div></div>

<p><strong>Update 4/22:</strong><br />
Not sure why the original script used to doubted the claim to palindromity, but I&#8217;ve fixed it now.  Demetri really does rock our socks off!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mike-griffith.com/blog/2009/02/i-used-to-play-sports-then-i-realized-you-can-buy-trophies-now-i%e2%80%99m-good-at-everything/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

