<?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/"
	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>Ubershmekel&#039;s Uberpython Pythonlog</title>
	<atom:link href="http://uberpython.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://uberpython.wordpress.com</link>
	<description>Python, music, sports, gaming and philosophy.</description>
	<lastBuildDate>Wed, 01 May 2013 04:57:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='uberpython.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ubershmekel&#039;s Uberpython Pythonlog</title>
		<link>http://uberpython.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://uberpython.wordpress.com/osd.xml" title="Ubershmekel&#039;s Uberpython Pythonlog" />
	<atom:link rel='hub' href='http://uberpython.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Farewell wordpress</title>
		<link>http://uberpython.wordpress.com/2013/01/09/farewell-wordpress/</link>
		<comments>http://uberpython.wordpress.com/2013/01/09/farewell-wordpress/#comments</comments>
		<pubDate>Wed, 09 Jan 2013 20:58:23 +0000</pubDate>
		<dc:creator>ubershmekel</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[: wordpress]]></category>

		<guid isPermaLink="false">http://uberpython.wordpress.com/?p=643</guid>
		<description><![CDATA[I imported all the posts to my new jekyll-bootstrap personal blog at yuvalg.com/blog and this old http://uberpython.wordpress.com won&#8217;t see any new posts &#8211; it&#8217;ll be kept as an archive. That&#8217;s it. I&#8217;m done. It took only 3 years from the first complaint to &#8230; <a href="http://uberpython.wordpress.com/2013/01/09/farewell-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=643&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I imported all the posts to my new <a title="yuvalg/blog" href="http://yuvalg.com/blog/">jekyll-bootstrap personal blog at yuvalg.com/blog</a> and this old http://uberpython.wordpress.com won&#8217;t see any new posts &#8211; it&#8217;ll be kept as an archive.</p>
<p>That&#8217;s it. I&#8217;m done. It took only 3 years from the <a title="whining about  wordpress" href="http://uberpython.wordpress.com/2009/11/20/leaving-wordpress-com/">first complaint</a> to finish. Looking back, I&#8217;m very grateful for the service.</p>
<h2>What I enjoyed at wordpress</h2>
<ul>
<li><span style="line-height:15px;">Yearly reports &#8211; they&#8217;re eye pleasing, informative and fun. Maybe google analytics could replace this somehow?</span></li>
<li>Ease of initial setup and maintenance.</li>
<li>Stable, even on surprise high traffic days.</li>
<li>Free.</li>
<li>They allow exporting the data! No lock-in is the mark of a serious business with good guys running it.</li>
</ul>
<h2>Why I&#8217;m leaving</h2>
<ul>
<li><a title="Example of annoying wordpress ads" href="http://i.imgur.com/ytMgq.png">Huge, annoying, ads</a> that they <strong>hide from the blog author </strong>so you have to go incognito to see what the rest of the world sees. You can pay wordpress to remove the ads, but what else are they hiding from the authors? I don&#8217;t know.</li>
<li><span style="line-height:15px;">No control over CSS. You can pay for that too but&#8230;</span></li>
<li>I already have a VPS so why not use it? (no way I&#8217;m installing the exploit ridden wordpress-php-mysql stack again though).</li>
<li>Jekyll allows me to edit the plain-text posts <strong>from any device</strong> with ease.</li>
<li>I wanted to rename the blog anyway.</li>
<li>Jekyll is a much simpler stack &#8211; preprocessing that results in a a lot of html files is a better fit for my blog. MySQL/PHP/Cache is oldschool. Though this wasn&#8217;t a concern of mine when hosted on wordpress.com &#8211; I still get a certain &#8220;higher road&#8221; satisfaction leaving.</li>
</ul>
<p>Goodbye wordpress.</p>
<p><a title="yuvalg blog" href="http://yuvalg.com/blog/">http://yuvalg.com/blog/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpython.wordpress.com/643/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpython.wordpress.com/643/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=643&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpython.wordpress.com/2013/01/09/farewell-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/48aae91146c6aa266ff2c9b3d1ab5d8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ubershmekel</media:title>
		</media:content>
	</item>
		<item>
		<title>Dominant misconceptions of recessive genes</title>
		<link>http://uberpython.wordpress.com/2012/10/16/dominant-misconceptions-of-recessive-genes/</link>
		<comments>http://uberpython.wordpress.com/2012/10/16/dominant-misconceptions-of-recessive-genes/#comments</comments>
		<pubDate>Tue, 16 Oct 2012 21:30:46 +0000</pubDate>
		<dc:creator>ubershmekel</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[dominant]]></category>
		<category><![CDATA[genes]]></category>
		<category><![CDATA[genetics]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[paperjs]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[recessive]]></category>
		<category><![CDATA[simulation]]></category>
		<category><![CDATA[traits]]></category>

		<guid isPermaLink="false">http://uberpython.wordpress.com/?p=631</guid>
		<description><![CDATA[I still remember my 10th grade Biology teacher explaining that because blonde hair is a recessive trait it will slowly vanish off the face of the earth. Recently I read a news article with a similar claim, and had an &#8230; <a href="http://uberpython.wordpress.com/2012/10/16/dominant-misconceptions-of-recessive-genes/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=631&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I still remember my 10th grade Biology teacher explaining that because blonde hair is a recessive trait it will slowly vanish off the face of the earth. Recently I read a news article with a similar claim, and had an argument with a few other biology and genetic majors. So I wrote a simulation.</p>
<p><a title="TraitSim" href="http://yuvalg.com/traitsim/">TraitSim</a> is an animated toy for exploring random, neutral gene proliferation with brown and blue eyes as an example. I also wrote a <a title="python simulation of genetic drift" href="https://github.com/ubershmekel/traitsim/blob/master/simulate.py">python version of the simulation</a> and ran it tens of thousands of times. Thanks <a title="PyPy" href="http://pypy.org/">pypy for the <strong>8.3x</strong> speedup</a>! Surprisingly the chance to win the gene-race is linear with the gene&#8217;s initial prevalence as can be seen in the following graph thanks to <a title="Matplotlib" href="http://matplotlib.org/">matplotlib</a>.</p>
<p><img class="alignnone" title="chance of going extinct" alt="" src="http://i.imgur.com/jb4QN.png" height="615" width="815" /></p>
<p>The thing with dominance is that it affects the gene expression which can be seen in the following graph:</p>
<p><img class="alignnone" title="prevalence of trait vs gene" alt="" src="http://i.imgur.com/Z4LM4.png" height="615" width="815" /></p>
<p>&nbsp;</p>
<p>And here&#8217;s <a title="graph generating source matplotlib" href="https://github.com/ubershmekel/traitsim/blob/master/graphs.py">the source that generated these from the data</a>. There&#8217;s more information in the <a title="TraitSim Page" href="http://ubershmekel.github.com/traitsim/">project page on github</a>. These github pages are strange creatures which I&#8217;m not sure how to work with yet. Can I modify the CSS or structure somehow without losing the benefit of the page generator?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpython.wordpress.com/631/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpython.wordpress.com/631/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=631&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpython.wordpress.com/2012/10/16/dominant-misconceptions-of-recessive-genes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/48aae91146c6aa266ff2c9b3d1ab5d8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ubershmekel</media:title>
		</media:content>

		<media:content url="http://i.imgur.com/jb4QN.png" medium="image">
			<media:title type="html">chance of going extinct</media:title>
		</media:content>

		<media:content url="http://i.imgur.com/Z4LM4.png" medium="image">
			<media:title type="html">prevalence of trait vs gene</media:title>
		</media:content>
	</item>
		<item>
		<title>Is selling placebos ethical?</title>
		<link>http://uberpython.wordpress.com/2012/10/07/is-selling-placebos-ethical/</link>
		<comments>http://uberpython.wordpress.com/2012/10/07/is-selling-placebos-ethical/#comments</comments>
		<pubDate>Sun, 07 Oct 2012 15:02:07 +0000</pubDate>
		<dc:creator>ubershmekel</dc:creator>
				<category><![CDATA[philosophy]]></category>
		<category><![CDATA[alternative]]></category>
		<category><![CDATA[justice]]></category>
		<category><![CDATA[law]]></category>
		<category><![CDATA[medicine]]></category>
		<category><![CDATA[morality]]></category>
		<category><![CDATA[quackery]]></category>

		<guid isPermaLink="false">http://uberpython.wordpress.com/?p=615</guid>
		<description><![CDATA[Lying isn&#8217;t murder but murder is such a good morality yardstick that I&#8217;ll use it anyway. Imagine the truth as the victim, though people can and do actually die at the hands of disingenuity. From the US justice system: First degree lie is any &#8230; <a href="http://uberpython.wordpress.com/2012/10/07/is-selling-placebos-ethical/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=615&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Lying isn&#8217;t murder but murder is such a good morality yardstick that I&#8217;ll use it anyway. Imagine the truth as the victim, though people can and do actually die at the hands of disingenuity. <a title="Degrees of murder" href="http://en.wikipedia.org/wiki/Murder_(United_States_law)#Degrees_of_murder_in_the_United_States">From the US justice system</a>:</p>
<ul>
<li><strong>First degree lie</strong> is any lie that is willful and premeditated.</li>
<li><strong>Second degree lie </strong>is a lie that is not premeditated or planned in advance.</li>
<li><strong>Voluntary</strong> <strong>falsehood </strong>is any intentional lying that involved no prior intent to lie, and which was committed under such circumstances that would &#8220;cause a reasonable person to become emotionally or mentally disturbed&#8221;.</li>
<li><strong>Involuntary falsehood</strong> stems from a lack of intention to lie but involving an intentional, or negligent, act leading to falsehood. Note that the &#8220;unintentional&#8221; element here refers to the lack of intent to bring about the falsehood. All three crimes above feature an intent to lie, whereas involuntary falsehood is &#8220;unintentional&#8221;.</li>
<li><strong>Assault </strong>could be related to telling misleading truths, or merely injuring veracity and not obliterating it. But that&#8217;s a story for another time.</li>
<li>Lies in <strong>self defense </strong>are generally considered acceptable if the lie doesn&#8217;t cause more harm than good.</li>
</ul>
<p>To understand the scale of offense, here&#8217;s what the penalty for a corresponding murder in Arizona would be:</p>
<table>
<tbody>
<tr>
<td>1st Deg Murder</td>
<td>25 &#8211; Life, or death penalty</td>
</tr>
<tr>
<td>2nd Deg Murder</td>
<td>10 &#8211; 25 years</td>
</tr>
<tr>
<td>Manslaughter</td>
<td>0 &#8211; 12.5 years</td>
</tr>
<tr>
<td>Negligent homicide</td>
<td>0 &#8211; 3.75 years</td>
</tr>
</tbody>
</table>
<p>A criminal killer would be punished for every person harmed in crime. The same logic applies to a serial or mass misinformer.</p>
<p>Why is this interesting? First of all I recently enjoyed the <a title="Justice: What's The Right Thing To Do? Episode 01 &quot;THE MORAL SIDE OF MURDER&quot;" href="http://www.youtube.com/watch?v=kBdfcR-8hEY">Harvard course on Justice</a> which was 12 hours of thought provoking discussion. I was amazed at how Professor Michael Sandel could sculpt even some seemingly moronic prepositions given by students into fine pieces of ethic argument. Thanks to this course I believe I may have the tools to <strong>tackle the moral dilemma of <a title="Quackery" href="http://en.wikipedia.org/wiki/Quackery">quackery</a></strong>, the promotion of unproven or blatantly fraudulent medical practices. Sadly the practice of quackery is still profitable and prevalent even after the 2000&#8242;s information revolution. But as much as I deplore the phenomenon I can&#8217;t bring myself to unequivocally denounce it because of its <a title="Placebo efficacy" href="http://en.wikipedia.org/wiki/Placebo_effect#Symptoms_and_conditions">10%-40% efficacy for certain ailments</a>. I can&#8217;t even unequivocally denounce the expensive ones because the <a title="Commercial features of placebo and therapeutic efficacy" href="http://dx.doi.org/10.1001%2Fjama.299.9.1016">more expensive inert pills have been found to be more effective</a>.</p>
<h2>Health Fraud</h2>
<p>To quote <a title="Tim Minchin's Storm the Animated Movie" href="http://www.youtube.com/watch?v=HhGuXCuDb1U">Tim Minchin</a>:</p>
<blockquote><p>Alternative Medicine [...]<br />
Has either not been proved to work,<br />
Or been proved not to work.<br />
You know what they call alternative medicine<br />
That&#8217;s been proved to work?<br />
Medicine.</p></blockquote>
<p>&#8220;Proved not to work&#8221; may refer to:</p>
<ul>
<li>Tested and found equally effective to another placebo</li>
<li>Tested and found not effective at all, or detrimental</li>
</ul>
<p>Advising and practicing alternative medicine that&#8217;s been proven worthless or harmful should be prohibited because they are only causing harm and profiting from it. As obvious as it may be, there are many people who have and will get away with this crime. But what about the effective placebos? From a <a title="Consequentialism" href="http://en.wikipedia.org/wiki/Consequentialism">consequential </a>perspective, they&#8217;re helping people and thus perfectly legitimate. From a <a title="Categorical imperative" href="http://en.wikipedia.org/wiki/Categorical_imperative">categorical</a> perspective, these quacks are committing <strong>1st degree lies</strong> or <strong>involuntary falsehood</strong> at the least. Either way, the truth is left dead. Quite a few people are left a lot poorer, but ~20% of these poorer individuals will actually feel better. Is that worth it?</p>
<h2>My philosophical judgement</h2>
<p>I&#8217;m an <a title="Agnosticism" href="http://en.wikipedia.org/wiki/Agnosticism">agnostic</a> <a title="Utilitarianism" href="http://en.wikipedia.org/wiki/Utilitarianism">utilitarian</a>, meaning to say I believe a global human utility function may exist though I don&#8217;t know exactly what it is. In fact I believe all philosophers were closeted utilitarians. They all tried to improve aspects of humanity, or at least fix wrongs. The difference between these great thinkers was merely their choice of utility function, or their methods of modeling it.</p>
<table>
<tbody>
<tr>
<th>Philosopher</th>
<th>Utility Function</th>
</tr>
<tr>
<td>Aristo</td>
<td><a title="Telos and teleology" href="http://en.wikipedia.org/wiki/Telos_(philosophy)">Telos </a>- The greater good is achieved by things meeting their purpose.</td>
</tr>
<tr>
<td>Immanuel Kant</td>
<td><a title="Maxims should be universal" href="http://en.wikipedia.org/wiki/Universalizability">Universalizability </a>- The greater good is achieved by committing actions which should be universalized.</td>
</tr>
<tr>
<td>Jim Rawls</td>
<td><a title="Rawls's minimax" href="http://en.wikipedia.org/wiki/Minimax#Maximin_in_philosophy">Max-min</a> &#8211; The greater good is achieved by maximizing the benefit of those which have the least of it.</td>
</tr>
</tbody>
</table>
<p>To summarize, I believe we should maximize the benefit of man kind. Preserving life being one of the most clearly visible tenants of any tribe.</p>
<p>Seeing as how doctors and scientists work so diligently to provide humanity with well-researched, candid and effective solutions to health problems, undermining their value is simply atrocious. The place of modern medicine in the modern home is tarnished by the likes of the keywords &#8220;natural&#8221;, &#8220;holistic&#8221;, &#8220;alternative&#8221; and relatives. This has gotten to the point where individuals who believe in alternative medicine are more likely to avoid a visit to the physician, this I&#8217;ve met first hand. I have no estimate on the amount of lives lost per avoidance of a visit to the doctor by a quack-fan, any data found is welcome. But still, I must conclude that the general damage of people <strong>avoiding life-saving treatment</strong> is fundamentally more detrimental than the benefits of allowing alternative medicine as it is today. Mainly because placebos and alternative medicine are mostly relevant for <a title="Placebo efficacy" href="http://en.wikipedia.org/wiki/Placebo#Symptoms_and_conditions">non-life threatening ailments</a>.</p>
<h2>A better future with regulation</h2>
<p>Considering the danger of undermining proper medicine, dispensers of alternative medicine should be licensed, registered and labeled as such and <strong>may only treat those ailments to which a placebo has been tested effective</strong>. I&#8217;m pretty sure these clinics wouldn&#8217;t mind posting on their walls and brochures &#8220;Licensed Alternative Medicine Clinic&#8221; or &#8220;Licensed Alternative Medicine Pill&#8221;. Hopefully this label is clear enough so a person who wishes to avoid ignorance can do so with ease.</p>
<p>Treatments statistically shown ineffective or detrimental should be prohibited by a government agency. Tight controls in the form of license revocation, fines and arrests of quacks promising more than they&#8217;re worth should allow a legitimate placebo market. That way doctors needn&#8217;t ever sacrifice their honesty to effectively prescribe placebos, and the general public can enjoy them at their leisure.</p>
<h2>Appendix</h2>
<ul>
<li><a title="Placebo" href="http://en.wikipedia.org/wiki/Placebo_effect">Placebo effect on wikipedia</a></li>
<li><a title="Quackery" href="http://en.wikipedia.org/wiki/Quackery">Quackery on wikipedia</a></li>
<li><a title="Components of placebo effect: randomised controlled trial in patients with irritable bowel syndrome" href="http://www.bmj.com/content/336/7651/999.reprint">A BMJ study concludes that the most effective component of placebos for irritable bowel syndrome is the doctor-patient relationship</a></li>
<li>The <a title="Lie on wikipedia" href="http://en.wikipedia.org/wiki/Lie">definition of &#8220;lie&#8221;</a> doesn&#8217;t include &#8220;involuntary falsehood&#8221;, though damage caused by it cannot be excused simply by a plea of ignorance.</li>
<li>Did you know some people believe and preach that <a title="Sodium bicarbonate from cancer.org" href="http://www.cancer.org/Treatment/TreatmentsandSideEffects/ComplementaryandAlternativeMedicine/HerbsVitaminsandMinerals/sodium-bicarbonate">baking soda cures cancer</a>?</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpython.wordpress.com/615/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpython.wordpress.com/615/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=615&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpython.wordpress.com/2012/10/07/is-selling-placebos-ethical/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/48aae91146c6aa266ff2c9b3d1ab5d8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ubershmekel</media:title>
		</media:content>
	</item>
		<item>
		<title>Why I&#8217;m not leaving Python for Go</title>
		<link>http://uberpython.wordpress.com/2012/09/23/why-im-not-leaving-python-for-go/</link>
		<comments>http://uberpython.wordpress.com/2012/09/23/why-im-not-leaving-python-for-go/#comments</comments>
		<pubDate>Sun, 23 Sep 2012 21:45:25 +0000</pubDate>
		<dc:creator>ubershmekel</dc:creator>
				<category><![CDATA[philosophy]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[exceptions]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://uberpython.wordpress.com/?p=620</guid>
		<description><![CDATA[First of all, Go seems like a great language. It has an excellent tutorial which I joyfully went through and found: Go is Fast. Concurrent by design. Typed (important for JIT and IDE&#8217;s) but not cumbersome and ugly like C or &#8230; <a href="http://uberpython.wordpress.com/2012/09/23/why-im-not-leaving-python-for-go/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=620&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>First of all, Go seems like a great language. It has an <a title="Tutorial of go" href="http://tour.golang.org/">excellent tutorial</a> which I joyfully went through and found:</p>
<ul>
<li>Go is Fast.</li>
<li>Concurrent by design.</li>
<li>Typed (important for JIT and IDE&#8217;s) but not cumbersome and ugly like C or C++&#8217;s <a title="C spiral parsing" href="http://c-faq.com/decl/spiral.anderson.html">spirals</a>.</li>
<li>Duck-type-esque interfaces.</li>
<li>The <a title="defer" href="http://golang.org/doc/effective_go.html#defer">defer</a> mechanism is really nifty.</li>
</ul>
<p>But there&#8217;s one problem I can&#8217;t live with. Which is a shame as I was eager to make the leap of faith in the name of concurrency. That problem is <strong>errors are handled in return values</strong>. 70&#8242;s style.</p>
<h2>Verbose and repetitive error handling</h2>
<p>The <a title="Error handling" href="http://blog.golang.org/2011/07/error-handling-and-go.html">designers of go consider this a virtue</a>.</p>
<blockquote><p>In Go, error handling is important. The language&#8217;s design and conventions encourage you to explicitly check for errors where they occur (as distinct from the convention in other languages of throwing exceptions and sometimes catching them). In some cases this makes Go code <strong>verbose</strong>, but fortunately there are some techniques you can use to minimize <strong>repetitive</strong> error handling.</p></blockquote>
<p>This is one of the things I can&#8217;t stand in C. <strong>Every single line requires an if statement </strong>to prevent programs from doing crazy things. This is an official, canonical example from the aforementioned link with perhaps &#8220;minimal repetitive error handling&#8221;:</p>
<pre>    if err := datastore.Get(c, key, record); err != nil {
        return &amp;appError{err, "Record not found", 404}
    }
    if err := viewTemplate.Execute(w, record); err != nil {
        return &amp;appError{err, "Can't display record", 500}
    }</pre>
<p>The correct way to call a function in Go is to wrap it in an if statement. Even <a title="Println error" href="http://golang.org/pkg/fmt/#Println">Println</a> returns an error value that I&#8217;m sure most on the planet will never check. Which brings me to&#8230;</p>
<h2>Errors passing silently &#8211; ticking time bombs to go</h2>
<p>To quote Tim Peters:</p>
<blockquote><p>Errors should never pass silently<br />
Unless explicitly silenced</p></blockquote>
<p>Go isn&#8217;t just stuck with verbose and repetitive error handling. It also makes it easy and tempting to ignore errors. In the following program we would trigger the doomsday device even if we failed protecting the presidential staff.</p>
<pre>func main() {
    http.Get("http://www.nuke.gov/seal_presidential_bunker")
    http.Get("http://www.nuke.gov/trigger_doomsday_device")
}</pre>
<p>What a shame. Oops.</p>
<address>In theory we could require the programmer never ignore returned errors. By static analysis or convention. In practice it&#8217;d be a pain worth enduring only in the most error critical programming tasks. Perhaps that&#8217;s Go&#8217;s purpose.</address>
<h2>panic/recover</h2>
<p>Panic and recover aren&#8217;t good enough as long as the standard library rarely uses them. Why is an array out of bounds any more cause for panic than a bad format string or a broken connection? Go wanted to avoid exceptions entirely but realizing they can&#8217;t &#8211; a few exceptions were tacked on here and there, leaving me confused as to which error happens when.</p>
<h2>Perhaps another time</h2>
<p>So I say this with much regret because Go has a lot of amazing ideas and features, but without modern error handling &#8211; I&#8217;m not <strong>go</strong>ing.</p>
<p>I&#8217;m still waiting for that open source, concurrent, <a title="quad core code shape benchmarks" href="http://shootout.alioth.debian.org/u64q/code-used-time-used-shapes.php">bottom left language</a> to come along. Any suggestions are more than welcome.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpython.wordpress.com/620/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpython.wordpress.com/620/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=620&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpython.wordpress.com/2012/09/23/why-im-not-leaving-python-for-go/feed/</wfw:commentRss>
		<slash:comments>91</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/48aae91146c6aa266ff2c9b3d1ab5d8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ubershmekel</media:title>
		</media:content>
	</item>
		<item>
		<title>Secret societies of reddit</title>
		<link>http://uberpython.wordpress.com/2012/08/24/secret-societies-of-reddit/</link>
		<comments>http://uberpython.wordpress.com/2012/08/24/secret-societies-of-reddit/#comments</comments>
		<pubDate>Fri, 24 Aug 2012 12:44:43 +0000</pubDate>
		<dc:creator>ubershmekel</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[conspiracy]]></category>
		<category><![CDATA[hats]]></category>
		<category><![CDATA[reddit]]></category>
		<category><![CDATA[secrets]]></category>
		<category><![CDATA[tinfoil]]></category>

		<guid isPermaLink="false">http://uberpython.wordpress.com/?p=610</guid>
		<description><![CDATA[Out there in the wild internet there are many dark corridors and places we&#8217;ll never be able to visit. Understandably. But on reddit?! I think the people deserve to at least vaguely know the inner workings of their contentocracy. Here&#8217;s &#8230; <a href="http://uberpython.wordpress.com/2012/08/24/secret-societies-of-reddit/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=610&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Out there in the wild internet there are many dark corridors and places we&#8217;ll never be able to visit. Understandably. But on reddit?! I think the people deserve to at least vaguely know the inner workings of their contentocracy. Here&#8217;s a list of a few most of us can only see the closed door of:</p>
<ul>
<li><a href="http://www.reddit.com/r/lounge">http://www.reddit.com/r/lounge</a> - A secret community open to whoever has reddit gold or has the &#8220;Charter Member&#8221; trophy. I&#8217;d describe it as a monoclejerk.</li>
<li><a href="http://www.reddit.com/r/modtalk">http://www.reddit.com/r/modtalk</a> - ??? &#8211; Perhaps a secret community for mods to discuss mod stuff.</li>
<li><a href="http://www.reddit.com/r/redditcourt">http://www.reddit.com/r/redditcourt</a> - ??? &#8211; Perhaps a secret community for judging and punishing reddit outlaws? Who are the reddit lawyers? Where&#8217;s reddit prison?</li>
<li>What more is there underneath the surface?</li>
</ul>
<p>What are we voting for? What&#8217;s running this <a href="http://i.imgur.com/DGq2C.jpg">voting machine</a>?</p>
<p>&lt;/tinfoil_hat&gt;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpython.wordpress.com/610/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpython.wordpress.com/610/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=610&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpython.wordpress.com/2012/08/24/secret-societies-of-reddit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/48aae91146c6aa266ff2c9b3d1ab5d8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ubershmekel</media:title>
		</media:content>
	</item>
		<item>
		<title>Anal About Analogies and Concurrency</title>
		<link>http://uberpython.wordpress.com/2012/07/17/anal-about-analogies-and-concurrency/</link>
		<comments>http://uberpython.wordpress.com/2012/07/17/anal-about-analogies-and-concurrency/#comments</comments>
		<pubDate>Tue, 17 Jul 2012 09:22:52 +0000</pubDate>
		<dc:creator>ubershmekel</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[analogies]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[locks]]></category>
		<category><![CDATA[room]]></category>
		<category><![CDATA[synchronization]]></category>
		<category><![CDATA[teaching]]></category>
		<category><![CDATA[threading]]></category>
		<category><![CDATA[waiting]]></category>

		<guid isPermaLink="false">http://uberpython.wordpress.com/?p=605</guid>
		<description><![CDATA[Analogies are tools, they can add intuition, fun and functional value to thoughts and concepts. Here are a few: Learning quadratic equations is more fun when thinking of balls and rockets flying around. Assembly can be thought of as an &#8230; <a href="http://uberpython.wordpress.com/2012/07/17/anal-about-analogies-and-concurrency/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=605&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Analogies are tools, they can add intuition, fun and functional value to thoughts and concepts. Here are a few:</p>
<ul>
<li>Learning quadratic equations is more fun when thinking of balls and rockets flying around.</li>
<li>Assembly can be thought of as an analogy for turing machines, C can be considered analogous to assembly.</li>
<li>
<address>Regular languages and finite automatons are equivalent, yet I personally would prefer solving an automaton problem over any regular language one.</address>
</li>
</ul>
<h2>&#8220;Lock&#8221; is frothy</h2>
<p>The word &#8220;lock&#8221; isn&#8217;t the best at describing what it does for concurrency. From <a title="simple wikipedia: lock" href="http://simple.wikipedia.org/wiki/Lock">simple wikipedia</a>:</p>
<blockquote><p>A lock is a fastening device: a thing which keeps people from opening something, such as a door or a box.</p></blockquote>
<p>But in concurrency locks don&#8217;t just prevent access, most of the time they cause whoever touches the lock to just wait there until the lock is &#8220;open&#8221;. Locks in the real world mean &#8220;you can&#8217;t have this&#8221; while locks in CS mean &#8220;hold on a second, I&#8217;m busy here&#8221;.</p>
<h2>A better analogy for locks &#8211; the waiting room</h2>
<p>Every book on the planet uses the example of a waiting room to explain locks. Why don&#8217;t we just call them waiting rooms? Here it goes:</p>
<p>Let&#8217;s say the resource we&#8217;re protecting is a doctor which wouldn&#8217;t be able to help 10 people (threads) at the same time because humans are terrible multitaskers. We invented the waiting room with a secretary (aka the operating system) that gives each person a ticket with some random number on it and when it&#8217;s your turn, she calls out your number and hands you the key to the room with the doctor in it. Now that you have the key, be careful with it, you can open the door but if you have a heart attack before you return it &#8211; no one else will be able to access the doctor and all the poor saps in the waiting room will be stuck there for all eternity.</p>
<h2>Table of analogies</h2>
<table>
<tbody>
<tr>
<td><a href="http://en.wikipedia.org/wiki/Lock_(computer_science)">Lock</a></td>
<td>A waiting room with one locked door</td>
</tr>
<tr>
<td><a href="http://en.wikipedia.org/wiki/Semaphore_(programming)">Semaphore</a></td>
<td>A waiting room with multiple locked doors</td>
</tr>
<tr>
<td><a href="http://msdn.microsoft.com/en-us/library/system.threading.manualresetevent.aspx">Manual Reset Event</a></td>
<td>A waiting room with a big sign that tells everybody whether to wait or go</td>
</tr>
<tr>
<td><a href="http://en.wikipedia.org/wiki/Deadlock">Deadlock</a></td>
<td>Two dumbasses are each waiting for a key held by the other, you might expect the secretary to intervene but she&#8217;s not that bright either.</td>
</tr>
</tbody>
</table>
<h2>The fun part &#8211; what can we do with these</h2>
<p>Now that we have better names/analogies, designing a concurrent system becomes an interior architecture problem. Build rooms and hallways to solve your computer problems. Check out this design for a <a href="http://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock">Readers-Writer-Lock</a> and imagine people walking around from room to room through the arrows. Try and figure out where people might get stuck or interfere with one another.</p>
<p><a title="Readers-writer-lock google drawing" href="https://docs.google.com/drawings/d/1NPPheCwICO-Hr1lQ-zGSOhTPmi8pK3DnGea-NukXkG4/edit">The google docs drawing source</a></p>
<p><a href="http://i.imgur.com/bON2R.png"><img class="alignnone" title="I actually know this one as &quot;Single reader multiple writer&quot; but I stick with whatever wikipedia says." src="http://i.imgur.com/bON2R.png" alt="" width="500" height="300" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpython.wordpress.com/605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpython.wordpress.com/605/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=605&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpython.wordpress.com/2012/07/17/anal-about-analogies-and-concurrency/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/48aae91146c6aa266ff2c9b3d1ab5d8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ubershmekel</media:title>
		</media:content>

		<media:content url="http://i.imgur.com/bON2R.png" medium="image">
			<media:title type="html">I actually know this one as &#34;Single reader multiple writer&#34; but I stick with whatever wikipedia says.</media:title>
		</media:content>
	</item>
		<item>
		<title>redditp &#8211; a fullscreen presentation with reddit</title>
		<link>http://uberpython.wordpress.com/2012/07/04/redditp-a-fullscreen-presentation-with-reddit/</link>
		<comments>http://uberpython.wordpress.com/2012/07/04/redditp-a-fullscreen-presentation-with-reddit/#comments</comments>
		<pubDate>Wed, 04 Jul 2012 15:03:26 +0000</pubDate>
		<dc:creator>ubershmekel</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[philosophy]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[fullscreen]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[reddit]]></category>
		<category><![CDATA[redditp]]></category>
		<category><![CDATA[show]]></category>
		<category><![CDATA[slide]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://uberpython.wordpress.com/?p=598</guid>
		<description><![CDATA[tl;dr &#8211; add a &#8220;p&#8221; before the &#8220;.com&#8221; to any subreddit you visit and voila, you have a fullscreen presentation of all the images. I like to show my friends cool stuff on the internet but browsing is a real &#8230; <a href="http://uberpython.wordpress.com/2012/07/04/redditp-a-fullscreen-presentation-with-reddit/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=598&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>tl;dr &#8211; add a &#8220;p&#8221; before the &#8220;.com&#8221; to any subreddit you visit and voila, you have a fullscreen presentation of all the images.</p>
<p>I like to show my friends cool stuff on the internet but browsing is a real conversation killer. You can&#8217;t really lean back, talk and have fun with friends while operating a website, surely not one as clunky as reddit. Even though RES does help.</p>
<p>So I just had to make this &#8220;hands-free&#8221; reddit mode. Where I can see:</p>
<ul>
<li>Cats <a title="redditp slide show of aww" href="http://redditp.com/r/aww">http://redditp.com/r/aww</a></li>
<li>Amazing views <a title="redditp presentation of earthporn" href="http://redditp.com/r/earthporn">http://redditp.com/r/earthporn</a></li>
<li>Tempting dishes <a title="redditp presentation of foodporn" href="http://redditp.com/r/foodporn">http://redditp.com/r/foodporn</a></li>
<li>Advice <a href="http://redditp.com/r/adviceanimals">http://redditp.com/r/adviceanimals</a></li>
<li>*cough* other stuff</li>
</ul>
<p>Easy!</p>
<p>Welp, not that easy, there was a lot of CSS to handle and the design right now is dead ugly but functional. Also, many stories on reddit aren&#8217;t images and I skip those that aren&#8217;t in a quirky way. If the url&#8217;s 4th character from the right is a dot, I display it. That&#8217;s a hack that works for imgur (which is most of reddit&#8217;s images) so I&#8217;m using it for now until I have more time to fix it. Any suggestions are more than welcome - <a title="redditp on github" href="https://github.com/ubershmekel/redditp">help improve redditp on github</a>! Also, comics are a pain to watch right now. I might implement some sort of scroll wheel zooming in the future, though that really is a bit of a different use case that might deserve a different site.</p>
<p>I guess not too surprisingly the first 200 visits where mostly to gonewild. You internet you&#8230;.</p>
<p><strong>edit - </strong>here are some stats from the launch night</p>
<div class="wp-caption alignnone" style="width: 558px"><img class="  " title="redditp launch night stats" src="http://i.imgur.com/K7DjE.png" alt="redditp launch night stats" width="548" height="300" /><p class="wp-caption-text">redditp launch night stats</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpython.wordpress.com/598/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpython.wordpress.com/598/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=598&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpython.wordpress.com/2012/07/04/redditp-a-fullscreen-presentation-with-reddit/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/48aae91146c6aa266ff2c9b3d1ab5d8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ubershmekel</media:title>
		</media:content>

		<media:content url="http://i.imgur.com/K7DjE.png" medium="image">
			<media:title type="html">redditp launch night stats</media:title>
		</media:content>
	</item>
		<item>
		<title>Introducing Absolute Ratio</title>
		<link>http://uberpython.wordpress.com/2012/04/28/introducing-absolute-ratio/</link>
		<comments>http://uberpython.wordpress.com/2012/04/28/introducing-absolute-ratio/#comments</comments>
		<pubDate>Sat, 28 Apr 2012 11:56:27 +0000</pubDate>
		<dc:creator>ubershmekel</dc:creator>
				<category><![CDATA[convenience]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[philosophy]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[science]]></category>
		<category><![CDATA[absolute]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[computer vision]]></category>
		<category><![CDATA[dsp]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ratio]]></category>

		<guid isPermaLink="false">http://uberpython.wordpress.com/?p=590</guid>
		<description><![CDATA[Let&#8217;s define the absolute ratio for positive numbers: When x is smaller than 1 return 1 / x, otherwise return x. Here are a few example values: x abs_ratio(x) 0.5 2 2 2 0.2 5 5 5 And a graph: Another spelling &#8230; <a href="http://uberpython.wordpress.com/2012/04/28/introducing-absolute-ratio/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=590&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Let&#8217;s define the <strong>absolute ratio</strong> for positive numbers:</p>
<p><img class=" alignnone" title="Absolute Ratio" src="http://i.imgur.com/TvspG.gif" alt="abs_ratio(x) = 1 / x when x &lt; 1, otherwise: x" width="89" height="55" /></p>
<p>When x is smaller than 1 return 1 / x, otherwise return x. Here are a few example values:</p>
<table>
<tbody>
<tr>
<th>x</th>
<th>abs_ratio(x)</th>
</tr>
<tr>
<td>0.5</td>
<td>2</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
</tr>
<tr>
<td>0.2</td>
<td>5</td>
</tr>
<tr>
<td>5</td>
<td>5</td>
</tr>
</tbody>
</table>
<p>And a graph:</p>
<p><img class="alignnone" title="Absolute Ratio Graph" src="http://i.imgur.com/5OE27.gif" alt="Absolute Ratio Graph" width="300" height="196" /></p>
<p>Another spelling for the same operator would take 2 positive numbers and give their absolute ratio:</p>
<p><img class="alignnone" title="Absolute ratio with two variables definition" src="http://i.imgur.com/iOCZY.png" alt="" width="511" height="160" /></p>
<p>And a graph:</p>
<p><a href="http://imgur.com/a/YjoZA"><img class="alignnone" title="Absolute ratio in 3D" src="http://i.imgur.com/3PIjD.png" alt="Absolute ratio in 3D" width="489" height="369" /></a></p>
<h2>Use case examples</h2>
<ul>
<li>Music and audio &#8211; an octave of a frequency F is 2F. More generally a harmony of a frequency F is N*F where N is a natural number. To decide if one frequency is a harmony of another we just need to get their absolute ratio and see if it&#8217;s whole. E.g. if abs_ratio(F1, F2) == 2 they&#8217;re octaves. If abs_ratio(F1, F2) is whole &#8211; they&#8217;re harmonies.</li>
<li>Computer vision &#8211; to match shapes that have similar dimensions e.g. their width is only 10% larger or smaller. We don&#8217;t care which is the bigger or smaller, we just want to know if 0.91 &lt; W1 / W2 &lt; 1.1 which may be easier to pronounce as abs_ratio(W1, W2) &lt; 1.1</li>
<li>Real life &#8211; when we see 2 comparable objects we&#8217;re more likely to say one is &#8220;three times the other&#8221; vs &#8220;one third the other&#8221;. Either way in our brains both statements mean the same concept. We think in absolute ratios.</li>
<li>General case &#8211; When you want to know if X is K times bigger than Y or vice versa and you don&#8217;t care which is the bigger one.</li>
</ul>
<h2>Interesting Properties</h2>
<div>
<ul>
<li>abs_ratio(Y / X) == abs_ratio(X / Y)</li>
<li>log(abs_ratio(X)) = abs(log(X))</li>
<li>log(abs_ratio(Y / X)) = abs(log(Y / X)) = abs(log(Y) &#8211; log(X))</li>
<li>You can see from the above that absolute ratio is somewhat of an absolute value for log-space.</li>
</ul>
<h2>What&#8217;s next for absolute ratio</h2>
</div>
<ul>
<li>I&#8217;d love to hear more use cases and relevant contexts.</li>
<li>What would be the written symbol or notation?</li>
<li>How can we get this operator famous enough to be of use to mainstream minds?</li>
<li>About negative numbers and zero &#8211; right now that&#8217;s undefined as I don&#8217;t see a use case for that domain.</li>
<li>For some code and graphs in python checkout <a href="https://github.com/ubershmekel/abs_ratio">https://github.com/ubershmekel/abs_ratio</a></li>
</ul>
<p>EDIT &#8211; I&#8217;m growing to like the binary form of the operator more so from now on let&#8217;s call it like this in python:</p>
<pre>def abs_ratio(a, b):
    return a / b if a &gt; b else b / a</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpython.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpython.wordpress.com/590/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=590&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpython.wordpress.com/2012/04/28/introducing-absolute-ratio/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/48aae91146c6aa266ff2c9b3d1ab5d8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ubershmekel</media:title>
		</media:content>

		<media:content url="http://i.imgur.com/TvspG.gif" medium="image">
			<media:title type="html">Absolute Ratio</media:title>
		</media:content>

		<media:content url="http://i.imgur.com/5OE27.gif" medium="image">
			<media:title type="html">Absolute Ratio Graph</media:title>
		</media:content>

		<media:content url="http://i.imgur.com/iOCZY.png" medium="image">
			<media:title type="html">Absolute ratio with two variables definition</media:title>
		</media:content>

		<media:content url="http://i.imgur.com/3PIjD.png" medium="image">
			<media:title type="html">Absolute ratio in 3D</media:title>
		</media:content>
	</item>
		<item>
		<title>Ah the old Reddit switch-a-roo analyzed</title>
		<link>http://uberpython.wordpress.com/2012/03/17/ah-the-old-reddit-switch-a-roo-analyzed/</link>
		<comments>http://uberpython.wordpress.com/2012/03/17/ah-the-old-reddit-switch-a-roo-analyzed/#comments</comments>
		<pubDate>Sat, 17 Mar 2012 20:53:40 +0000</pubDate>
		<dc:creator>ubershmekel</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[gephi]]></category>
		<category><![CDATA[networkx]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[reddit]]></category>
		<category><![CDATA[switcharoo]]></category>

		<guid isPermaLink="false">http://uberpython.wordpress.com/?p=585</guid>
		<description><![CDATA[So after clicking through what seemed an infinite amount of tabs from one of these switcheroo comments I finally wrote down the script which analyzed the graph. I&#8217;d suggest you ignore the following png and take a gander at the network pdf &#8230; <a href="http://uberpython.wordpress.com/2012/03/17/ah-the-old-reddit-switch-a-roo-analyzed/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=585&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>So after clicking through what seemed an infinite amount of tabs from one of these <a href="http://www.reddit.com/r/WTF/comments/qy31w/well_this_is_completely_disgusting/c41fntu?context=1">switcheroo comments</a> I finally wrote down <a title="A script which crawls reddit for the old switcheroo" href="http://codepad.org/rQJCLyxR">the script which analyzed the graph</a>. I&#8217;d suggest you ignore the following png and take a gander at the <a href="http://uberpython.files.wordpress.com/2012/03/znetwork5.pdf">network pdf of the switcharoo graph because you can click through to the links</a>.</p>
<p><img class="alignnone" title="The old reddit switch-a-roo analyzed image" src="http://i.imgur.com/Z1klR.png" alt="The old reddit switch-a-roo analyzed image" width="655" height="926" /></p>
<p>To recap &#8211; 50 nodes, 52 edges, though there are probably more out there that point into some point of that chain. And here are the awards:</p>
<ul>
<li><a href="http://www.reddit.com/r/pics/comments/ia0ij/watching_fellowship_of_the_ring_tonight_and_never/c225zkg">First comment by jun2san who started the shenanigans</a></li>
<li><a href="http://www.reddit.com/r/aww/comments/mwxbg/my_sister_and_my_puppy_yes_she_is_a_puppy_d/c34ixoe">Farthest down link which points to a cycle start</a></li>
<li><a href="http://www.reddit.com/r/pics/comments/iw0el/my_cousin_has_leukemia_and_went_to_this_golf/c277gni?context=3">Farthest down link if the graph weren&#8217;t directed</a></li>
</ul>
<p>There. I hope that didn&#8217;t take away from the magic.</p>
<h2>Appendix &#8211; The hardships</h2>
<p>This was overly hard to do &#8211; first of all NSFW links gave me the &#8220;are you over 18?&#8221; prompt which for some reason I wasn&#8217;t able to solve by cookies. I eventually turned to the mobile version of the site (append &#8220;.compact&#8221;) to avoid the prompts completely. Also, matplotlib and networkx aren&#8217;t that fun for drawing graphs it seems. To visualize and output the graph I eventually used <a href="http://gephi.org/">gephi</a> which was somewhat easy although has it&#8217;s clunkiness baggage.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpython.wordpress.com/585/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpython.wordpress.com/585/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=585&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpython.wordpress.com/2012/03/17/ah-the-old-reddit-switch-a-roo-analyzed/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/48aae91146c6aa266ff2c9b3d1ab5d8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ubershmekel</media:title>
		</media:content>

		<media:content url="http://i.imgur.com/Z1klR.png" medium="image">
			<media:title type="html">The old reddit switch-a-roo analyzed image</media:title>
		</media:content>
	</item>
		<item>
		<title>Python isn&#8217;t English and iterator &#8220;labels&#8221;</title>
		<link>http://uberpython.wordpress.com/2012/02/13/python-isnt-english-and-iterator-labels/</link>
		<comments>http://uberpython.wordpress.com/2012/02/13/python-isnt-english-and-iterator-labels/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 22:28:39 +0000</pubDate>
		<dc:creator>ubershmekel</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[continue]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[generators]]></category>
		<category><![CDATA[iterators]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[yield]]></category>

		<guid isPermaLink="false">http://uberpython.wordpress.com/?p=575</guid>
		<description><![CDATA[Us python fanboys like to think of python as similar to English and thus more readable. Let&#8217;s examine a simple piece of code: for item in big_list:     if item.cost &#62; 5:         continue     &#8230; <a href="http://uberpython.wordpress.com/2012/02/13/python-isnt-english-and-iterator-labels/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=575&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Us python fanboys like to think of python as similar to English and thus more readable. Let&#8217;s examine a simple piece of code:</p>
<pre>for item in big_list:
    if item.cost &gt; 5:
        continue
    item.purchase()</pre>
<p>For our discussion there are only 3 kinds of people:</p>
<ol>
<li>People who have never seen a line of code in their life.</li>
<li>Have programmed in other languages but have never seen python.</li>
<li>Python programmers.</li>
</ol>
<div>We&#8217;ll dabble between the first 2 groups and how they parse the above. Let&#8217;s try to forget what we know about python or programming and read that in English:</div>
<ul>
<li>&#8220;for item in big_list&#8221; &#8211; either we&#8217;re talking about doing something for a specific item in a big_list or we&#8217;re talking about every single item. Ambiguous but the first option doesn&#8217;t really make sense so that&#8217;s fine.</li>
<li>&#8220;if item.cost &gt; 5&#8243; &#8211; non-programmers are going to talk about the period being in a strange place, but programmers will know exactly what&#8217;s up.</li>
<li>
<div>&#8220;continue&#8221; &#8211; That&#8217;s fine, keep going. English speakers are going to get the completely wrong idea. As programmers we&#8217;ve grown used to this convention though its meaning in English is very specifically equivalent to what pythonistas call &#8220;pass&#8221; or &#8220;nop&#8221; in assembly. We really should have called this &#8220;<strong>skip</strong>&#8221; or something.</div>
</li>
<li>&#8220;item.purchase()&#8221; &#8211; non-programmers are going to ask about the period and the parentheses but the rest grok that easily.</li>
</ul>
<p>So I&#8217;m pretty sure this isn&#8217;t English. But it&#8217;s fairly readable for a programmer. I believe programmers of any of the <a title="tiobe index" href="http://www.tiobe.com/content/paperinfo/tpci/index.html">top 8 languages on the TIOBE index</a> can understand simple python. I definitely can&#8217;t say the same for Lisp and Haskell. Not that there&#8217;s anything wrong with Lisp/Haskell, these languages have specialized syntax for their honorable reasons.</p>
<h2>Continue is a silly word, what about iterator labels?</h2>
<p>Let&#8217;s say I want to break out of an outer loop from a nested loop, eg:</p>
<pre>for item in big_list:
    for review in item.reviews:
        if review &lt; 3.0:
            # next item or next review?
            continue
        if review &gt; 9.0:
            # stop reading reviews or stop looking for items?
            break</pre>
<p>Java supports <strong>specific breaks and continues</strong> by adding labels to the for loops but I think we can do better. How about this:</p>
<pre>items_gen = (i for i in big_list)
for item in items_gen:
    for review in item.reviews:
        if review &lt; 3.0:
            items_gen.continue()
        if review &gt; 9.0:
            items_gen.break()</pre>
<p>But how can that even be possible you may ask? Well, nowadays it isn&#8217;t but maybe one day if <a title="python ideas" href="http://mail.python.org/mailman/listinfo/python-ideas">python-ideas</a> like this idea we can have nice things. Here&#8217;s how I thought it could work: a for-loop on a generator can theoretically look like this:</p>
<pre>while True:
    try:
        item = next(gen)
        # do stuff with item
    except StopIteration:
        break</pre>
<p>But if it worked like I propose below we can support the specific breaks and continues:</p>
<pre>while True:
    try:
        item = next(gen)
        # do stuff with item
    except gen.ContinueIteration:
        pass
    except gen.StopIteration:
        break
    except StopIteration:
        break</pre>
<p>So every generator could have a method which throws its relevant exception and we could write specific breaks and continues. Or if you prefer a different spelling could be &#8220;break from mygen&#8221; or &#8220;continue from mygen&#8221; as continue and break aren&#8217;t allowed as method names normally.</p>
<p>I think this could be nice. Although many times I found myself using nested loops I actually preferred to break the monster into 2 functions with one loop each. That way I could use the return value to do whatever I need in the outer loop (break/continue/etc). So perhaps it&#8217;s a good thing the language doesn&#8217;t help me build monstrosity&#8217;s and forces me to flatten my code. I wonder.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpython.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpython.wordpress.com/575/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpython.wordpress.com&#038;blog=4565747&#038;post=575&#038;subd=uberpython&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpython.wordpress.com/2012/02/13/python-isnt-english-and-iterator-labels/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/48aae91146c6aa266ff2c9b3d1ab5d8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ubershmekel</media:title>
		</media:content>
	</item>
	</channel>
</rss>
