<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><description></description><title>Flonk</title><generator>Tumblr (3.0; @wzdd)</generator><link>http://flonk.lardcave.net/</link><item><title>Grar, Python</title><description>&lt;p&gt;Python’s nested scopes suck, because you can’t modify (well, rebind) variables in an outer scope unless it’s the global scope. Here’s some code:&lt;/p&gt;
&lt;pre&gt;def f1():
    blah = 0

    def f2():
        if blah == 0:
            print 'hi'

    f2()

f1()
&lt;/pre&gt;
&lt;p&gt;This prints ‘hi’, as you’d expect. Here’s some more code:&lt;/p&gt;
&lt;pre&gt;def f1():
    blah = 0

    def f2():
        if blah == 0:
            print 'hi'
        blah += 1

    f2()

f1()
&lt;/pre&gt;
&lt;p&gt;This prints ‘UnboundLocalError: local variable ‘blah’ referenced before assignment’. This is because any rebinding must be either local or global — it can’t reference a nested scope. What happened here is that the interpreter looked at the definition of f2, saw an assignment to “blah”, and made a new local variable.&lt;/p&gt;
&lt;p&gt;The details are in &lt;a href="http://www.python.org/dev/peps/pep-0227/"&gt;PEP 0227&lt;/a&gt;. The workaround is to use a container class. For example, with blah = [0], the statement blah[0] += 1 doesn’t rebind blah, it just references it, so it is allowed.&lt;/p&gt;
&lt;p&gt;Guido’s justification for this behaviour is that if you’re rebinding things in non-local scopes you should be using a class. I think he’s right if you’re doing anything complex. The trouble is that writing classes involves a lot of syntax: for simple tasks (say, involving a counter and some helper functions), a function local and some helper functions are easier to read. Here’s the same thing as a class:&lt;/p&gt;
&lt;pre&gt;class Adder(object):
    def __init__(self):
        self.blah = 0

    def f2(self):
        if self.blah == 0:
            print 'hi'

        self.blah += 1

    def f1(self):
        self.f2()

Adder().f1()
&lt;/pre&gt;</description><link>http://flonk.lardcave.net/post/50063584</link><guid>http://flonk.lardcave.net/post/50063584</guid><pubDate>Sun, 14 Sep 2008 14:29:00 +1000</pubDate></item><item><title>Nationals leader Peter Ryan, on abortion:
It seems intrinsically wrong somehow that a pregnant woman...</title><description>&lt;p&gt;Nationals leader Peter Ryan, on abortion:&lt;/p&gt;
&lt;blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt;It seems intrinsically wrong somehow that a pregnant woman can go to a hospital and, depending on what room she goes into, her child could well be born, looked after carefully and lovingly in a neo-natal ward, and survive and grow on the one hand; or if she were to go into another room, the child could be killed.&lt;br/&gt;
&lt;/blockquote&gt;
&lt;p&gt;Emotive language aside, the issue is actually a lot worse than this: if this pregnant woman goes into a still different room she could end up with, say, her tonsils removed, or an artificial leg! Mr. Ryan seems a little unclear about what goes on inside hospitals, and I hope that for his sake that his advisers introduce him to the concept gradually. (&lt;a href="http://www.news.com.au/heraldsun/story/0,21985,24322583-662,00.html"&gt;source&lt;/a&gt;)&lt;/p&gt;</description><link>http://flonk.lardcave.net/post/49433712</link><guid>http://flonk.lardcave.net/post/49433712</guid><pubDate>Wed, 10 Sep 2008 03:10:00 +1000</pubDate></item><item><title>I learned a new word! It’s nystagmus, rapid involuntary movements of the eyes.</title><description>I learned a new word! It’s &lt;b&gt;nystagmus&lt;/b&gt;, rapid involuntary movements of the eyes.</description><link>http://flonk.lardcave.net/post/48971044</link><guid>http://flonk.lardcave.net/post/48971044</guid><pubDate>Sat, 06 Sep 2008 17:06:45 +1000</pubDate></item><item><title>There’s been a lot of talk recently about the brain’s “default network”...</title><description>&lt;p&gt;There’s been a lot of talk recently about the brain’s “&lt;a href="http://neurocritic.blogspot.com/2007/01/daydreaming-and-thought-sampling.html"&gt;default network&lt;/a&gt;” — an area which (if I have got this right (I almost certainly haven’t)) becomes active when the brain isn’t focused on the external environment. Planning the future, thinking about yourself, and daydreaming all involve this region.&lt;/p&gt;
&lt;p&gt;Anyway. Based on the number of times I’ve got distracted recently, started browsing the Web, and then realised I’ve visited the same page twice in a row, I think I’ve managed to train my default network to type Web addresses into a browser. Good job, those neurons. It’s a pity brains aren’t like computers and I can’t get what is essentially the screen saver to search for aliens or fold proteins or something.&lt;/p&gt;</description><link>http://flonk.lardcave.net/post/48725246</link><guid>http://flonk.lardcave.net/post/48725246</guid><pubDate>Fri, 05 Sep 2008 00:30:00 +1000</pubDate></item><item><title>I just discovered I can get rid of the unsightly hand-marks on my laptop using an eraser. Nifty!</title><description>I just discovered I can get rid of the unsightly hand-marks on my laptop using an eraser. Nifty!</description><link>http://flonk.lardcave.net/post/47263427</link><guid>http://flonk.lardcave.net/post/47263427</guid><pubDate>Mon, 25 Aug 2008 12:59:47 +1000</pubDate></item><item><title>
feminine |ˈfɛmɪnɪn|adjective3 Music (of a cadence) occurring on a metrically weak beat.

Sorry...</title><description>&lt;blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt;
&lt;b&gt;fem&lt;/b&gt;&lt;b&gt;i&lt;/b&gt;&lt;b&gt;nine&lt;/b&gt; |ˈfɛmɪnɪn|&lt;br/&gt;adjective&lt;br/&gt;&lt;b&gt;3&lt;/b&gt; &lt;i&gt;Music&lt;/i&gt; (of a cadence) occurring on a metrically weak beat.&lt;br/&gt;
&lt;/blockquote&gt;
Sorry about the weak beats, ladies. :(</description><link>http://flonk.lardcave.net/post/46551705</link><guid>http://flonk.lardcave.net/post/46551705</guid><pubDate>Wed, 20 Aug 2008 00:11:00 +1000</pubDate></item><item><title>
1421: The Year China Discovered the World  […] was first published in 2002 in Great...</title><description>&lt;blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt;
&lt;i&gt;&lt;b&gt;1421: The Year China Discovered the World&lt;/b&gt;&lt;/i&gt;  […] was first published in 2002 in Great Britain and was published in the United States under the title &lt;i&gt;&lt;b&gt;1421: The Year China Discovered America&lt;/b&gt;&lt;/i&gt;. &lt;br/&gt;
&lt;/blockquote&gt;
&lt;p&gt;*snicker*&lt;/p&gt;
&lt;p&gt;— &lt;a href="http://en.wikipedia.org/wiki/1421:_The_Year_China_Discovered_the_World"&gt;Wikipedia article&lt;/a&gt;&lt;/p&gt;</description><link>http://flonk.lardcave.net/post/45758677</link><guid>http://flonk.lardcave.net/post/45758677</guid><pubDate>Wed, 13 Aug 2008 14:33:00 +1000</pubDate></item><item><title>My new super awesome chain chomp hat, knitted by Catie! :)</title><description>&lt;img src="http://media.tumblr.com/fUrGGnovUcbgebscWUW6vkRJ_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;My new super awesome chain chomp hat, knitted by Catie! :)</description><link>http://flonk.lardcave.net/post/44929183</link><guid>http://flonk.lardcave.net/post/44929183</guid><pubDate>Wed, 06 Aug 2008 22:20:58 +1000</pubDate></item><item><title>Looking at the giant stack of 2-minute noodles in the ERTOS kitchen, I started wondering if it would...</title><description>&lt;p&gt;Looking at the giant stack of 2-minute noodles in the ERTOS kitchen, I started wondering if it would be possible to grind them up and use the huge amount of energy contained within to, say, power a car.&lt;/p&gt;
&lt;p&gt;Unfortunately petrol has an energy density of &lt;a href="http://en.wikipedia.org/wiki/Gasoline#Energy_content"&gt;44.4 megajoules per kilogram&lt;/a&gt;, whereas the noodles provide about 1300 kilojoules per pack. You get about 12 packs per kilogram, but that’s still a serious energy deficit. So scratch that idea.&lt;/p&gt;
&lt;p&gt;On the other hand, I suspect I use energy equivalent to less than ten packs’ worth of noodles per day. If I could somehow modify myself to run on petrol, I’d only need, like, a spoonful daily!&lt;/p&gt;</description><link>http://flonk.lardcave.net/post/42973957</link><guid>http://flonk.lardcave.net/post/42973957</guid><pubDate>Mon, 21 Jul 2008 16:53:00 +1000</pubDate></item><item><title>BeautifulSoup</title><description>&lt;p&gt;&lt;a href="http://www.crummy.com/software/BeautifulSoup"&gt;Beautiful Soup&lt;/a&gt; is a fun Python library that screen-scrapes HTML, even if the HTML isn’t very good (the technical term here being “valid”). I finally got around to giving it a try, and while browsing the source I learned that it provides a bunch of other classes that aim to parse different varieties of broken HTML (which would seem to defeat the purpose somewhat, but anyway). They’re named ICantBelieveItsBeautifulSoup, MinimalSoup, and BeautifulStoneSoup. There’s also a SOAP (remote procedure call protocol designed by committee) parser, named BeautifulSOAP. The code then includes this section:&lt;/p&gt;
&lt;pre&gt;#Enterprise class names! It has come to our attention that some people
#think the names of the Beautiful Soup parser classes are too silly
#and "unprofessional" for use in enterprise screen-scraping. We feel
#your pain! For such-minded folk, the Beautiful Soup Consortium And
#All-Night Kosher Bakery recommends renaming this file to
#"RobustParser.py" (or, in cases of extreme enterprisiness,
#"RobustParserBeanInterface.class") and using the following
#enterprise-friendly class aliases:
class RobustXMLParser(BeautifulStoneSoup):
    pass
class RobustHTMLParser(BeautifulSoup):
    pass
class RobustWackAssHTMLParser(ICantBelieveItsBeautifulSoup):
    pass
class RobustInsanelyWackAssHTMLParser(MinimalSoup):
    pass
class SimplifyingSOAPParser(BeautifulSOAP):
    pass&lt;/pre&gt;
&lt;p&gt;For coming up with the enterprise class name of RobustInsanelyWackAssHTMLParser, the Beautiful Soup guy is my favourite guy du jour, and as a reward (to borrow from &lt;a href="http://itre.cis.upenn.edu/~myl/languagelog/"&gt;Language Log&lt;/a&gt;) he wins a year’s free subscription to this blog.&lt;/p&gt;</description><link>http://flonk.lardcave.net/post/42461053</link><guid>http://flonk.lardcave.net/post/42461053</guid><pubDate>Thu, 17 Jul 2008 00:20:00 +1000</pubDate></item><item><title>Today I made this delicious margherita pizza, which helped to...</title><description>&lt;img src="http://media.tumblr.com/fUrGGnovUb3btgn8AHAXoFhI_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;Today I made this delicious margherita pizza, which helped to soothe the pain of failing to claw my way back to the top of my friend’s scoreboard in &lt;a href="http://www.handdrawngames.com/DesktopTD/Game.asp"&gt;Desktop Tower Defense&lt;/a&gt;.</description><link>http://flonk.lardcave.net/post/41195385</link><guid>http://flonk.lardcave.net/post/41195385</guid><pubDate>Mon, 07 Jul 2008 01:05:45 +1000</pubDate></item><item><title>Today I told Bryn that his blog should support comments and he replied that my Tumblr made him feel...</title><description>Today I told Bryn that his blog should support comments and he replied that my Tumblr made him feel like not allowing them was acceptable. I told him that I hated myself for legitimising this anti-community attitude, and then I thought I’d blog about it.</description><link>http://flonk.lardcave.net/post/40778777</link><guid>http://flonk.lardcave.net/post/40778777</guid><pubDate>Thu, 03 Jul 2008 14:26:57 +1000</pubDate></item><item><title>I made sourdough! It was delicious, and really fun to make.</title><description>&lt;img src="http://media.tumblr.com/fUrGGnovUaapsb27HuCVjSiH_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;I made sourdough! It was delicious, and really fun to make.</description><link>http://flonk.lardcave.net/post/38619652</link><guid>http://flonk.lardcave.net/post/38619652</guid><pubDate>Tue, 17 Jun 2008 00:32:10 +1000</pubDate></item><item><title>Drains to Space, from seanbonner via io9.</title><description>&lt;img src="http://media.tumblr.com/fUrGGnovUa5xdfi68XQ5SRtn_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;Drains to Space, from &lt;a href="http://www.flickr.com/photos/seanbonner/2573107467/in/photostream/"&gt;seanbonner&lt;/a&gt; via &lt;a href="http://io9.com/5016046/save-the-aliens-dont-litter"&gt;io9&lt;/a&gt;.</description><link>http://flonk.lardcave.net/post/38227943</link><guid>http://flonk.lardcave.net/post/38227943</guid><pubDate>Fri, 13 Jun 2008 16:05:00 +1000</pubDate></item><item><title>I just discovered AM radio. It’s like podcasts, but it comes over the air using some sort of...</title><description>&lt;p&gt;I just discovered AM radio. It’s like podcasts, but it comes over the air using some sort of voodoo system. It’s pretty great! When I turned it on this evening, I heard a pleasant, middle-aged female voice saying “… so it’s not a great superhero movie, but not a terrible one either, and I must say, as someone who’s been taking a large quantity of steroids for medical reasons, that I looked upon the Hulk breaking out with a great deal of sympathy.”&lt;/p&gt;
&lt;p&gt;Then a man came on and started talking about Grote Reber.&lt;/p&gt;</description><link>http://flonk.lardcave.net/post/38120392</link><guid>http://flonk.lardcave.net/post/38120392</guid><pubDate>Thu, 12 Jun 2008 20:33:00 +1000</pubDate></item><item><title>Genetic interactions suggest that Buffy acts downstream of Reaper, Grim and Head involution...</title><description>&lt;blockquote&gt;Genetic interactions suggest that Buffy acts downstream of &lt;a href="http://www.sdbonline.org/fly/dbzhnsky/reaper1.htm"&gt;Reaper&lt;/a&gt;, &lt;a href="http://www.sdbonline.org/fly/sturtevant/grim1.htm"&gt;Grim&lt;/a&gt; and &lt;a href="http://www.sdbonline.org/fly/dbzhnsky/headind1.htm"&gt;Head involution defective&lt;/a&gt;, and upstream of the apical caspase &lt;a href="http://www.sdbonline.org/fly/dbzhnsky/dronc1.htm"&gt;Dronc&lt;/a&gt;.&lt;br/&gt;
&lt;/blockquote&gt;
&lt;p&gt;— &lt;a href="http://www.sdbonline.org/fly/sturtevant/buffy1.htm"&gt;Buffy&lt;/a&gt;, from The Interactive Fly&lt;/p&gt;</description><link>http://flonk.lardcave.net/post/37835253</link><guid>http://flonk.lardcave.net/post/37835253</guid><pubDate>Tue, 10 Jun 2008 18:10:35 +1000</pubDate></item><item><title>280slides</title><description>&lt;p&gt;&lt;a href="http://280slides.com/"&gt;280slides&lt;/a&gt; is a presentation app written in a new Web framework called Objective-J, which is a port of the Cocoa APIs to JavaScript along with an Objective-C-like syntax. There’s an interview with the developers &lt;a href="http://ajaxian.com/archives/an-interview-with-280-north-on-objective-j-and-cappuccino"&gt;here&lt;/a&gt;, but it’s audio and frankly not that enlightening: for example, they respond to questions about implementation detail with “that’s all just implementation detail” and “we use the technology available”. Probably the most interesting part is that the developers consider using Objective-J to be working at a higher level than using other Web frameworks. While other frameworks try to co-exist with each other, Objective-J assumes it owns the DOM, intercepts all events (to support its own event mechanism), etc etc. As a result, the app doesn’t look like a Web app. It reminds of Java’s Swing, at least in the early days, where Swing apps looked obviously different to native apps, usually worse, and all your keyboard shortcuts wouldn’t work because the Swing guys decided that being cross-platform was more important than being usable on any particular platform. Oh yeah, and you couldn’t use any of the standard system dialogs (such as a file selector) because Swing had its own, nastier, one. Gah. Bad memories.&lt;/p&gt;
&lt;p&gt;Even so, 280slides is a pretty fantastic program. It looks great and feels very much like a desktop app. Maybe not looking (or behaving) like a Web app isn’t such a huge deal when most Web apps look terrible.&lt;/p&gt;</description><link>http://flonk.lardcave.net/post/37568711</link><guid>http://flonk.lardcave.net/post/37568711</guid><pubDate>Sun, 08 Jun 2008 13:17:00 +1000</pubDate></item><item><title>Professor Plum’s sells test tubes now! Here my torso...</title><description>&lt;img src="http://media.tumblr.com/fUrGGnovU9uxp4ls9dKhmvuP_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;Professor Plum’s sells test tubes now! Here my torso models one, filled with a mysterious green liquid, which I later drank. If you have any suggestions for things I can do with the test tubes, please email them to wzdd lardcave spam net spam spam spam.</description><link>http://flonk.lardcave.net/post/37272541</link><guid>http://flonk.lardcave.net/post/37272541</guid><pubDate>Thu, 05 Jun 2008 23:29:44 +1000</pubDate></item><item><title>I found a good plot summary of Indiana Jones and the Kingdom of the Crystal Skull online. Warning!...</title><description>&lt;p&gt;I found a good plot summary of Indiana Jones and the Kingdom of the Crystal Skull online. Warning! Spoilers.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Mutt picks then to enact his brilliant escape plan, which consists of punching the guard, then running, and setting the tent they went through on fire.&lt;br/&gt;&lt;br/&gt;SPALKO: Curses! We’ll never catch them now! &lt;br/&gt;&lt;br/&gt;DOVCHENKO: Couldn’t we just go around the burning tent?&lt;br/&gt;&lt;br/&gt;SPALKO: And walk over the Ground of Middling Discomfort? SILENCE!&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://seriousfic.livejournal.com/67089.html"&gt;Plot summary&lt;/a&gt;&lt;/p&gt;</description><link>http://flonk.lardcave.net/post/37106955</link><guid>http://flonk.lardcave.net/post/37106955</guid><pubDate>Wed, 04 Jun 2008 16:29:00 +1000</pubDate></item><item><title>As Raphael’s hand caressed Leonardo’s firm, green thigh, he sighed and smiled down at...</title><description>&lt;blockquote&gt;As Raphael’s hand caressed Leonardo’s firm, green thigh, he sighed and smiled down at the blue-masked turtle. “One day, you’ll take off that mask, Leo,” he whispered, stroking the shivering, exhausted turtle. “One day,” Leonardo responded, pushing Raphael back on his shell, his strength suddenly returning in a rush of arousal… god ok i can’t write any more ahaha&lt;br/&gt;
&lt;/blockquote&gt;
— Catie speculating on how Anaïs Nin would write fiction if she were a blogger after reading &lt;a href="http://www.wired.com/entertainment/theweb/commentary/alttext/2008/06/alttext_0604"&gt;this article&lt;/a&gt;</description><link>http://flonk.lardcave.net/post/37101256</link><guid>http://flonk.lardcave.net/post/37101256</guid><pubDate>Wed, 04 Jun 2008 15:19:12 +1000</pubDate></item></channel></rss>
