fuzzy notepad

Atom feed [blog] blog

[blog] Just enough Git to be (less) dangerous

Do you just hate Git? Are you perfectly happy with Mercurial (or, yikes, Subversion) but once a month you have to brave Git because everyone and their damn dog is now using GitHub? Are you vaguely aware that about half of all Git commands will probably delete all your work forever, but you don’t know which ones and you don’t want to spend three weeks poring over the documentation?

Good news! I wrote you this amazing Internet post. I hope I can mash just enough Git into your face that you will be less likely to set things on fire, and also less terrified that you might set things on fire. This should also be enough to make the Git documentation a little more comprehensible; it’s extremely thorough, but also overwhelming and nonsensical if you haven’t already read half of it.

I’m trying to keep this brief but also potentially useful to people who have never touched version control at all, so there are some 101 bits sprinkled throughout. Fear not! I don’t actually think Mercurial users have no idea what a patch is.

[blog] Sylph: the programming language I want

Creating a programming language is apparently all the rage these days, and it’s got me thinking about what I would really like to see in one. I’m starting to suspect the things I want are either impossible or mutually incompatible, so I’d better write them down and let smarter people tell me why I can’t have everything and also a pony.

I’m strongly influenced by my love of Python, my aversion to C and C++, my fascination with Rust, and the bits of Haskell I understand. I very recently read an overview of Nim, which is part of what got my juices flowing. Also I have a lot of fond memories of what Perl 6 could have been, so, fair warning.

This is a brain dump, not a linear narrative, so some of this might be mutually referential or causally reversed or even complete nonsense. Please pardon the dust.

[blog] Starbound airlock

Starbound is a 2D exploration and building game currently in development. Yes, yes, it’s like Minecraft, except 2D, and with actual art, and fun.

A recent update added wiring (or perhaps upgraded it into being useful?), which lets you wire anything into anything. A notable feature of Starbound’s wiring over Terraria’s or Minecraft’s is that logic gates are actual objects, not emergent behavior. So you don’t have to build everything out of goddamn NANDs. Also, the wires aren’t physical objects; they’re just straight lines connecting an input to an output, they take up no space in the world, they don’t participate in any form of collision detection, and they appear on a separate layer that you only see when you’re using the wiring tool.

There’s not a whole lot you can do with the wiring in Starbound yet. The devices you can control are, for the most part, lights and doors. Other players can just destroy anything you build, anyway. So it’s really only useful for visual effect right now, much like everything else you can build.

Still, there are a couple mechanisms of interest. Last night I built an airlock, and while it’s not an astounding feat of electrical engineering, I thought it was an interesting enough problem that someone else might enjoy reading about it. So here I am, blogging for once. I hope you’re happy.

[blog] Eevee gained 2269 experience points

Eevee grew to level 28!

I’m a bit late; my birthday was on the 12th. Oh, well.

I don’t know what to say about 2014, really, so let’s just start typing and see what happens.

  • Bought the house, finally divorced myself of the old one. Paid half of it off.

  • I made some (one and a half?) ZDoom maps. I first got into the ZDoom community over a decade ago — I found articles on the ZDoom wiki with my own edits in them from that long ago — and only now have created a map that’s actually playable. By which I mean it has an exit.

    In the course of doing this, I also wrote a bunch of patches for SLADE, the editor I’m using and the only one that really exists for Linux.

  • I released a couple more tiny modules on PyPI: cgettext, classtools.

  • I actually got my dream roguelike, flax, to the point that it’s playable.

  • I started trying to draw, on and off, again. I’ve recently gotten in the habit of doing a little daily comic, since my partner is doing the same.

  • I learned Inform 7 and wrote some of a text adventure. I also made a whole lot of aborted attempts at writing fictional prose for my partner’s Flora universe; it turns out fiction is hard, maybe.

I feel like I’ve grown a lot, but I can’t quite explain how. I tried a lot of things I haven’t really tried before, and they’re all informing how I think about things now. I don’t feel like I have a lot to show for all of them, though. Hm.

For once, I’m also considering what I would like to do this coming year.

  • Write more. I only wrote six posts last year! I blame this mostly on my emphasizing this as a “real” blog — I’m now unsatisfied with posting anything that isn’t as long and informative as, let’s face it, the PHP post. I need to knock that off. Back in my LiveJournal days, I once wrote a post every day for a month; perhaps another such month is in order.

  • Do a bit more with this domain. Ever since I bought it, I half-intended to also host separate pages for things I’ve made, and I don’t mean just cramming them onto a single “projects” page. I don’t know what form this will take yet, but as long as the domain is actually my name, I’d like for it to be something that more accurately reflects me.

  • Finish a game. Probably not flax, but hopefully this text adventure. It would be great if I had a website where I could host a text adventure, too… hmm…

  • Write a book. Or at least a significant chunk of one. I have a lot of ideas for a programming book (series?).

  • Make money. I have a salary from a “real” job, of course, but I would really like to prove that I could someday support myself with my own endeavors. Any of the above are possible candidates.

Only five things in a year. How hard can it be?

[blog] Maybe you’re just not very funny

Jeez. Seems like everyone’s outraged over something these days.

Take for example this guy:

Why don’t you try focusing your civil unrest at something that dearly needs it, like the fact that today the Israeli air force struck a school with a missile killing 10 people, most of which were children. I suppose you’re all ok with that, as long as the missile didn’t call the school ‘retarded’ first, right? … I encourage you to look at yourselves and think about what really matters.

He’s outraged that people could ignore his pet issue in favor of something he doesn’t think is important. God, why can’t he shut up about it and go on with his life like everyone else?

So, the clown above is “jontron” (some YouTube celebrity, famous for playing video games or something?), who only recently appeared on anyone’s radar because of this exchange:

The quote is from his Twitter response, in which he doubles (triples?) down on the use of the word “retarded”. It also contains this bit:

My job as a comedian is to make people laugh and feel better about their lives.

Ha, get it? I’m laughing and feeling better about myself because at least I’m not retarded, like those peop— err, like the PlayStation 4. What a knee-slapper!

Along with various other comedians who have recently become outraged over discovering that not everything they say is comedy gold, jontron is missing what actually happened here. When I read the above sequence of events in order, I see:

  1. Some Internet funny man makes a joke that hinges on the word “retarded”. That’s kinda gross. But a lot of people do gross things sometimes. Alas.
  2. Funny man responds to polite criticism by throwing the same word back in the face of the person who asked him not to use it.
  3. Funny man responds to resulting crapstorm by going on about the REAL problems in the world, which he doesn’t talk about either. Oh, and then he thought maybe a Hitler joke would show how hilarious he is.

Look carefully. What happened immediately before the mention of a crapstorm? It wasn’t the use of the word! It was the part where he responded to “hey this is a sore spot for me” by punching the other person right in the sore spot. Because that’s when he shifted from maybe, accidentally, being a bit of an asshole… to conclusively and deliberately being a total asshole.

Why? What’s the fear here? That if you break the flow to say something serious like “Oh, my bad” or even “I’m aware but I’m not willing to stop” or even just nothing, you’ve failed at being funny? Here’s a hot tip: if someone is upset at what you said, you already fucked it up, at least for that person.

Because, here’s the thing: you can tell jokes about horrible and tragic things. It really is possible. The trick is that they only work if the audience finds them funny; otherwise, you’re just being horrible. You take that gamble when you decide to go for that flavor of joke. If you lose the gamble, it doesn’t mean everyone else is super sensitive; it just means you lost the gamble. Or maybe you’re not as funny as you think you are.

He also did an interview in which he quadrupled-down, with gems like this:

I can guarantee you, without naming names, that every big YouTuber or Hollywood celeb that apologizes for saying a ‘bad word’ does NOT mean it 99 percent of the time. It’s all public relations nonsense. Unless something truly hateful is said in an definitively hateful context, like in the case of Michael Richards at the Laugh Factory, I would take their apologies with a grain of salt.

See, he didn’t double down and aim a slur directly at another person. He doubled down and aimed a slur directly at another person. It’s completely different, and that’s why he’s way better and doesn’t deserve any of this. Also, even if he did apologize, he still wouldn’t mean it, and no one else does either, so there, neener neener, he still wins.

Way to make me laugh and feel better about my life!

But maybe there’s a good reason for all this. Maybe there’s a good reason this guy decided to repeat his failed joke, rather than turn the failure into a better joke. Maybe there’s a reason he defends “retarded” as though he literally can’t imagine how to tell jokes without it.

Maybe he’s just not very funny.

Sorry, bro. But don’t take it out on everyone else when you suck at your job.

This is, of course, something of a running theme. Jim Norton, the man who had plastic surgery to get his frown permanently etched onto his face, semi-famously went on a TV show to debate the merit of rape jokes with a token feminist, and subsequently earned the world record for saying “free speech” the most times in ten minutes.

He was right, of course: he is perfectly allowed to joke about rape all he wants. No one is proposing we make it illegal. But maybe, hey, uh, could you think twice before cracking jokes about things other people are sensitive to that you only personally experience via other people’s jokes?

Again, you’d think Jim literally cannot find anything to tell jokes about besides rape. Why else would he go on national television to argue why he really really really needs to be allowed to tell rape jokes?

Hey, speaking of Jim Norton, I got this awesome fan tweet from him earlier:

. @eevee You don’t tweet enough. You should weigh in more often because you say such important, interesting things.

Thanks for the shoutout, Jim! I’ll be sure to let you know what I think more often. But you replied to the wrong tweet. This is what I said to you:

i’m reminded of Guy Who’s Really Offended When Not Everyone Thinks He’s Really All That Funny, @JimNorton

True to form, Jim was offended enough that he felt the need to supertweet1 a complete nobody to his third of a million followers. Damn. You really need to learn to take a joke, Jim.

To round out the trifecta, today I also bumbled upon an article in Playboy written by Gilbert Gottfried, in which he advises his readers to not apologize for being offensive, and also calls them all cunts. I’m led to believe that latter part is funny, because it has a naughty word in it.

He summarizes:

Ninety percent of my speech was devoted to making jokes about Anderson’s vagina and whether it would ever be tight again. …

… Afterward, when the show was over and everybody was shaking hands and pretending not to be pissed off, Anderson gave me a hug and whispered in my ear, “I hate you.” That’s all she said. She didn’t demand an apology or tell me she was going to ruin my career. All she said was “I hate you.” And that was the end of it. …

Do you have the same emotional maturity as somebody with gigantic fake breasts whose main cultural contribution is running in slow motion on the beach?

Perfectly reasonable. Why can’t we be subtle and mature about these things? There’s no need to, I don’t know, get a two-page article published in a magazine with five million readers when you’re offended over something. Exercise some discretion!

Like Jim Norton, Gilbert Gottfried is a comedian who chose to make a name for himself being “controversial”, which is a cutesy way of saying “offensive”. Now, when it turns out some of their jokes are offensive, they get outraged at the people who have the audacity to not find them funny. How dare these Internet people! Why can’t the entire world just sit and be quietly uncomfortable, like the audience members I want them to be? Don’t you know who I am?

The funny thing is that this article has an entire paragraph of self-deprecating Jew jokes. It might be the only funny part of the article. Because when someone makes jokes about themselves, there remains a shred of empathy, of shared understanding of a tragedy. Someone in this conversation actually knows what the experience of being a Jew is like, and we can laugh at his ha-ha-only-serious jokes together.

That’s pretty different from jokes about recent tragedies, or serious handicaps, or rape. With the self-deprecating Jew jokes, “Jewish” is the setup. With those other things, the terrible thing is usually the punchline. There’s no empathizing there: it’s just playing Mad Libs with problems you’ve never had to worry about.

If you didn’t notice, I’ve been calling these people “offended” or “outraged”. Let me drive that home, because it kinda grinds my gears.

Why, exactly, is it “outrage” when someone finds a joke distasteful, but not when the comedian takes that reaction personally? It’s still a person feeling something was a personal slight, or that something broke social rules, or however you want to define these terms. But the writhing masses are outraged, whereas I guess the poor celebrities only have righteous fury, which is funny beause I’m pretty sure “rage” and “fury” mean basically the same thing.

This leads to some really fucked-up interpretations of events, too. Earlier on The Twitter someone hypothetically defended jontron to me, essentially saying “maybe he reacted poorly because people yelled at him”.

Well, wait, hang on. Even if they had, who fucking cares? Presumably those people thought using “retarded” as a joke was super fucking rude, so why would yelling at a rude person be inappropriate? And if it is, why doesn’t that apply to him?

This is a recurring pattern, I don’t understand it, and it’s complete bullshit.

  1. Person A does some dickish thing, possibly directed at person B.
  2. Person B calls out person A for it.
  3. Multiple onlookers rush to admonish person B for being so rude.
  4. Why aren’t you yelling at A? And how are you idiots not being rude as well? What the fuck is going on here?

If you only ever harp on “nice” people to stay nice 100% of the time, you’re giving assholes a free pass to be assholes. That makes you an asshole. Knock it off.

OK that’s all I got and I am bad at conclusions. Also honestly I only wrote any of this to see if Jim Norton will reply to me again.

  1. you know, the opposite of subtweet, i.e., reply to someone with junk in front so all your followers see it 

[blog] Braid

There was a shooting, but this post is not about that shooting.

This post is about what we tried to do to stop thinking about the shooting, because the deluge of apologists can wear on a person after a while. So we got some lunch and sat down to watch some funny Internet videos. We enjoy the vidcons, so I scrolled back through retsupurae looking for something that caught my eye.

I found “Braidple Story“, which sounded promising because I would still gladly call Braid the best vidcon I’ve ever played.

Spoilers: the game is terrible, like you do. More spoilers: the game is a hamfisted attempt at recreating Braid’s theme that falls completely flat, because 99% of it is the protagonist’s overt creeping on this girl (with totally believable voice acting and horrifying dialogue) and then right at the end she goes “Leave me alone ugh!” and that’s the end of the game.

All told, that didn’t really help get my mind off of Gender Stuff. But it did put my mind on something else, which is: Braid.

A brief recap of Braid

Since time-travelling platformers are not everyone’s cup of tea, let me go over the game’s “plot” real quick here. If you haven’t played it yet and want to, you might want to just bail on this post until you’ve cleared out your Steam queue.

Braid is a simple platformer, complete with overt Mario homages, including the chasing of a princess. The game is split into six chapters, and before each one, you get few paragraphs of flavor text about what your protagonist Tim is thinking. (Wikiquote has it all quoted in its entirety if you care to read it.)

World 2 (Time and Forgiveness) opens with the plot of the game: “Tim is off on a search to rescue the Princess.” But not just any princess; the narrative makes clear that the two were in a relationship, and Tim made some (perhaps many) mistakes, and now feels he ought to be forgiven for having learned from them. Tim’s memories are muddled, but very clear in his mind is the sight of the princess turning sharply away, her braid waving at him. (Ah! That’s the game’s title!) This chapter is the introduction to the controls: you can walk around, jump, and activate switches. You then run across a platforming puzzle that requires almost inhuman timing to get right, and this is where you discover the core mechanic of the game: you can reverse time, at will, whenever you want, all the way back to when you entered the level if you so choose. And so, quite appropriately, you can undo any mistakes you’ve made and learn from them.

World 3 (Time and Mystery) reveals that Tim was the one who left, and now he’s trying to go back to her. Apparently he felt trapped by her expectations, which he himself had preserved by undoing all of his own missteps, and felt that he could never escape beyond the person she thought he was. Sometimes, he needed to be immune to her expectations, to preserve some other part of himself even as he undid his mistakes. And so we have the new mechanic for World 3: in each level, some objects glow a sparkly green, and these objects aren’t affected by the reversal of time. If you use a sparkly green key to open a door and then reverse time, the door will close, but the key will remain broken. Everything else is the same, but this makes your power vulnerable.

World 4 (Time and Place) remarks on how certain places remind us of memories of those places — of other times. Tim sets off wandering to various places where he has memories of his princess, in the hopes that he will find her there, or even be transported back to when he was with her. In this world, the levels literally link time with place: time advances forwards as you move to the right, and backwards as you move to the left. You can still reverse time, but only for yourself; time for everything else in the world is linked to your horizontal position.

World 5 (Time and Decision) hints that Tim is leaving another lover to search for his princess, the obsession is so strong. Here, whenever you reverse time, a shadow of yourself is left behind to act out whatever you had last done from that point forward. You can see your former decisions play out alongside your current ones.

World 6 (Hesitance) mentions a ring, and strongly suggests that it’s an engagement or even marriage ring from the princess. He still wears it, and it makes it harder to romance other women — so he’s learned to approach slowly when he wears the ring, or forego wearing it entirely whenever he can bear it. In this world, Tim can place his ring anywhere he wishes, and time will be slowed down within a small radius of it. He can, as usual, still rewind time, but slowing it down in only part of the level can make patterns go out of sync. Curiously, this is the first world to have a black background and break with the naming scheme. The music is, as I recall, also significantly darker than before.

This brings us to the end of the story. But as this is a game about going backwards, the final part is World 1.

World 1 has no title. The intro text paints Tim as eerily calculating, and explicitly names him as moving contrary to everyone else — or everyone else contrary to him.

World 1 begins with three simple levels, each one removing more platforms from the last. The gimmick here is simple: time moves backwards. When you enter a level, you see a series of events play out backwards. You can still reverse time, but that makes everything else move forwards. This has funny implications for cause and effect: if you jump on a monster, it can’t die, because the next moment it experiences is the preceding moment and it hadn’t yet been jumped on. Wacky platforming abounds.

After these few simple introductory levels, we have the final boss, in a sense. Tim emerges into the catacombs of a castle; above him, the princess is in the arms of a knight yelling “I’ve got you!” She gets away from him and yells “Help!”; he calls to her to get back to him. And the chase is on: the knight has a stomping fit which starts to bring down parts of the ceiling above you, and a wall of flame starts to approach from the left. Both Tim and the princess run to the right, running from the fire and the knight respectively, and occasionally the princess stops to throw a switch that clears an obstacle for Tim. After some excellent platforming, assisted by the occasional time reversal, she finally reaches her bedroom, and he finally escapes the catacombs and climbs a lattice to arrive outside her window.

The screen flashes, and the player loses control. Seemingly nothing has changed.

But now the music is running backwards, and everything the player just did with Tim is running backwards as well. And as you watch the level unplay itself, a horrible realization creeps up on you.

Remember, this is still World 1, and everything but Tim has been playing out in reverse.

As Tim runs backwards through the catacombs, events take on a completely different meaning. Tim is now chasing after the princess, not running ahead of her. The princess isn’t clearing obstacles out of the way; she’s closing off all the escape routes out of the catacombs. And she never escaped from the knight — rather, the last we see of her is as she jumps into his arms, and he takes her away from the madman in the basement.

Perhaps we should’ve seen this coming. The level, the only one in World 1 that has a title at all, is called simply “Braid” — the last thing he remembers seeing when she turned away from him.

The shift in perspective is absolutely, beautifully, perfect. The intro levels are simple so the mechanic doesn’t stick in your head too hard, and the entire castle level is designed to let you forget that everything else is moving in reverse.

There’s an epilogue. It has some simple platforming, but for the most part it’s just more flavor text. This stuff is a bit more abstract; it speaks of moments of Tim’s childhood, of an experimenting scientist, of the birth and death of the world.

The interpretation

After I played Braid, I was fascinated by the somewhat more mysterious passages in the epilogue. I scurried to the Internet to see if anyone else had made any deep sense out of them.

I was pretty disappointed with what I found. The epilogue quotes “Now we are all sons of bitches”, and uses the words “radiated” and “ashes”. So it became something of a widespread consensus that the game was clearly one big metaphor for the Manhattan Project. That interpretation has never made any sense to me, yet everyone who said it seemed to feel very clever for having figured it out. (The game’s author has refused to say what the game is about.)

If you haven’t read through the script, now might be a good time. Remember, this is all the text in the entire game. There are no NPCs, no dialogue; just these glimpses of a story.

I always thought the game was about two things. The first: time, which you have to really stretch to relate to the development of a nuclear bomb. The second: Tim, who is after all the protagonist of both the game and most of the plot text.

It all seems pretty cut and dry to me. The game is entirely about undoing what we’ve already done, and Tim wishes to return to the arms of his “princess”. The various worlds are the ways he dwells on her and imagines how things might have gone differently. Consider also that the prose, despite being written in third-person, is written from Tim’s point of view — and we already know Tim is an unreliable narrator. He said he left the princess, but we watched her run away from him.

Thus I have slightly different interpretations of what the worlds were actually about. World 2 is the obsession with reliving mistakes, trying to see where he went wrong, and feeling like figuring that out means he’s undone the mistake entirely. World 3 is the uncomfortable discovery that not everything can be so easily undone. World 4 is his aimless drifting through the world, as time passes him by. World 5 is confusion between what he did and what he might have done, so intertwined that there’s no telling which is real. World 6 is a final memento he obsesses over, a trinket that no longer holds any real meaning but still distorts everything around it from Tim’s perspective.

World 1 is the actual breakup. His princess was stolen away by a knight in shining armor. He remembers it backwards, because his perspective is just that warped, and that’s the only way to preserve his view of events.

This all seems pretty reasonable, right? Tim is a creep. You’ve been playing as a creep the entire time. Reading through the transcript again now, I can’t believe I didn’t think he was ten times creepier at the time. Were they even dating, or was he just stalking her? If he stalked her, why did he have a wedding ring? He left other women to go pine over her some more, and they missed him? Crrrreepy.

But everyone chose to focus on the couple lines about the Manhattan Project, which need some severe contorting to relate to the rest of the game. Why?


Watching that longplay of the Braid ripoff, in the context of everything that’s happened in the last couple days, I realized something.

Nobody wants to be Tim.

Well, sure. But it’s stronger than that: nobody wants to believe Tim could exist.

We played as Tim. He was just a platformer guy, but we identified with him on some basic level. He was our little avatar, solving cool time puzzles with us. We were Tim.

But we don’t want to be Tim. Nobody wants to be Tim. So instead we want to reach out for something, anything else that will let us not be the Tim the game appears to be presenting to us. And the epilogue provides us an escape hatch: if the entire game is a metaphor for the atom bomb, then we aren’t Tim. We aren’t who the game tells us Tim is, anyway. We’re something else, something fuzzier, something we don’t really have to think about.

It doesn’t matter that the metaphor doesn’t make any sense. It doesn’t matter that more of it is about plain old daily life than about nuclear explosions. It only matters that it’s not Tim.

And this, I believe, is the heart of the backlash against #YesAllWomen and anyone expressing any real outrage about the UCSB shooting. Because these things drive home that some people just might be Tim, or worse. Maybe some of us are Tim. And we don’t want to be Tim, whatever the cost.

So we paint the shooter as “just” mentally ill, crazy, depraved. We’d call him a religious fundamentalist (read: nut) if we could, or a terrorist if we could, or just a plain old natural criminal if we could. But we’ve only got so much to work with here.

We paint lines around him. Thick, hard lines. Lines to make it clear that he’s nothing like us. Even the people who fueled his rage, the people who practically identify themselves as antagonists, the people he seemed to identify with, draw these lines. Not one of us. Nope. Never heard of ‘im.

Because even they, fundamentally, recognize that they don’t want to be Tim. They want to put Tim as far away from themselves as possible. They don’t want to think about how many other Tims might be in their midst; that’s deeply unsettling, and the human mind is great at rationalizing such things away. So instead of using this as an opportunity to root out the Tims and make the group better by pushing them out, we distance ourselves from this particular Tim, and just don’t think about it further.

And that’s why Tim was free to do whatever he wanted. In his whole tale, he never remembered anyone telling him no, or pushing back. The only time we see anyone really resist Tim in a meaningful way is when the final level runs in reverse and the princess runs away from him — something he doesn’t even believe happened.

The most striking part of the epilogue, for me:

The candy store. Everything he wanted was on the opposite side of that pane of glass. The store was decorated in bright colors, and the scents wafting out drove him crazy. He tried to rush for the door, or just get closer to the glass, but he couldn’t. She held him back with great strength. Why would she hold him back? How might he break free of her grasp? He considered violence.”

They had been here before on their daily walks. She didn’t mind his screams and his shrieks, or the way he yanked painfully on her braid to make her stop. He was too little to know better.”

She picked him up and hugged him: “No, baby,” she said. He was shaking. She followed his gaze toward treats sitting on pillows behind the glass: the chocolate bar and the magnetic monopole, the It-From-Bit and the Ethical Calculus; and so many other things, deeper inside. “Maybe when you’re older, baby,” she whispered, setting him back on his feet and leading him home, “Maybe when you’re older.”

Every day thereafter, as before, she always walked him on a route that passed in front of the candy store.”

Does this sound familiar? Tim wanted the candy, but she wouldn’t let him have it. He felt entitled to it, he got violent over it as best he could. And when he couldn’t have it, he grew to resent her for taunting him with it, even though to her it was just the usual route home.

How far is it from Tim to hands that are a bit too grabby? To rape, murder, a mass shooting?

Violence is not a simple question of yes or no; plenty of cultural factors affect it. How many Tims are we enabling by refusing to acknowledge that he already exists, that we’re creating and nurturing Tims all the time?

Even one is too many. In our world, everything has green sparkles.

As for Tim

Enough heavy stuff. Let’s talk about World 1 a bit.

Trick question: where does the story end? Is it where the game ends, in World 1, or is it where the numbering ends, in World 6?

Or… is it both? Is this one big cycle, as Tim hops from princess to princess, and the game begins anew? Is it his own cycle, of reliving his time with her over and over?

Ah, but there’s something else about World 1.

The game has 8 stars hidden throughout it, generally not even visible without some outrageously finnicky puzzle solving. But if you manage to find 7 of them, something changes in the final level. Two of the switches in the catacombs now have green sparkles.

It’s a very subtle change, but it means that Tim can throw a switch, reverse time, and now go through the passage he opened earlier than he could’ve otherwise. It’s a small difference, but it’s enough to let Tim run so far ahead that the wall of fire, the wall of causality, falls off the screen entirely.

In fact, he gets so far ahead that he gets ahead of the princess before she reaches her bedroom. He’s already nearby and waiting when she springs her last (actually first) distraction on him: dropping a chandelier. And with some well-timed jumping, Tim can hop on the chandelier as it un-falls upwards, and ride it up to the ceiling.

Tim catches up to the princess.

The screen whites out, more violently than before. When it returns, the princess is gone. The music is gone.

In her bedroom, directly above her bed, Tim finds the final 8th star. Then there’s nothing left to do but run back to the beginning, leave through a previously inaccessible door, and see the epilogue again.

I love this, by the way. The slightest change in the level design changes absolutely everything.

If World 1 truly is the beginning of a cycle, then getting all the stars is the end of it. Because there is no princess after that. He caught up with her, and she was a phantom. And since it’s World 1, where time moves backwards, this last level is really the first level of the game. Even the levels are numbered in reverse in World 1. Without a princess, none of the rest of it needs to happen. Tim is free.

You can only find the stars by replaying the game at least one more time, and the original 360 version had a speedrun achievement to encourage you to play it a few more times. So you really do get to see Tim jump through the same hoops over and over again.

But the stars are different. The stars are new. The stars are things you — and thus Tim — never noticed the first time around. The stars require patience and careful thought to find. And only once you, and Tim, have found all these moments hidden away in Tim’s romanticized memories, can Tim get a different ending.

I can’t know what the game’s author was truly going for, but I’m content to believe that it’s this: maybe we can’t undo what we’ve done, but there’s always hope for Tim going forward, with a little help from someone willing to stick through it with him.

I leave you with the very end of the epilogue:

He cannot say he understood all of this. Possibly he’s more confused now than ever. But all these moments he’s contemplated — something has occurred. The moments feel substantial in his mind, like stones. Kneeling, reaching down toward the closest one, running his hand across it, he finds it smooth, and slightly cold.”

He tests the stone’s weight; he finds he can lift it, and the others too. He can fit them together to create a foundation, an embankment, a castle.”

To build a castle of appropriate size, he will need a great many stones. But what he’s got, now, feels like an acceptable start.”

If you’re interested: Braid’s climax, and Braid’s secret climax.

[blog] Comment policy

I’m still dealing with cretins’ comments on my PHP post, two years later. I’ve always made an effort to never delete or ban any of them, in the interest of allowing discussion and all that jazz.

But let me tell you, it is fucking exhausting reading all that and I am tired of it. And I just realized I wrote a sassy post about Mozilla.

So the comment policy is thus:

Keep your fucking vitriol to your own blog.

Disagree with me all you want. In fact, I encourage it! I love to know when I’m wrong, and arguing over things is how I figure out why I think them in the first place.

But this space is mine, and I even said long ago that the comments are really optional. The important stuff here is what I say, not what you say. If what you say is clearly only intended to be destructive, it and you are gone. I’ve had enough.

[blog] Mozilla and free speech

What a fucking clusterfuck.

In case you were absent from the Internet the past two weeks, or for some reason don’t care about tech shenanigans, the following has happened:

  • Six years ago: Brendan Eich, inventor of JavaScript and founding member of Mozilla, donated $1,000 to support Prop 8, the amendment to the California state constitution that sought to define marriage to exclude same-sex couples, and that apparently would have voided 18,000 existing same-sex marriages.

  • Two years ago: Someone dug up and published a list of everyone who donated to Prop 8. The tech community noticed Eich, CTO at the time, was on the list. There was some furor, enough that Eich responded on his blog. Nothing else really happened, and it blew over.

  • March 24: Eich was made CEO. People still remember that whole Prop 8 thing. All hell breaks loose.

  • April 1: OKCupid adds a big splash page for Firefox users, asking them to maybe switch browsers in protest of Eich’s appointment. All hell escalates.

  • April 1: Eich does an interview with CNet in which he says he’s the best man for the job. The interviewer asks him pointedly about Prop 8 several times, and Eich deflects. All hell escalates further.

  • April 3: Eich steps down as CEO. All hell becomes sort of morose quietness.

  • April 3: The world outside the tech community catches wind of all this. All hell breaks loose, again.

I’m pretty interested in that last part, but first:

[blog] A brief overview of copyright

Technical people can probably skip this one; if you’re even remotely aware of what open source is, you probably have a working grasp of copyright.

Alas! It seems no one else does. So here is my primer.

Legal disclaimer, of course: I am not a lawyer and have no idea what I’m talking about, but this is my current understanding of how stuff works.

Egocentric disclaimer: This is all pretty specific to the United States, assuming any of it is correct at all, but as far as I’m aware the Berne Convention should mean that this is at least faintly similar is most other countries.

Copyright is literally that thing it says: the right to copy. If you own copyright over a work, you have the exclusive right to copy that work as you please. (The point being that no one else does.) “Copy” here is pretty broad; it can mean literally reproducing, selling, performing, or even creating something new based on it. All of these involve copying the original work in some form.

This is also why it’s not spelled “copywrite”.

Thus, when you hold copyright over something, you are the only person who is allowed to do pretty much anything with it except enjoy it. If someone else copies or sells or shares your work, you can go sue them out the butthole.

There are details.


Copyright applies to creative works. You can copyright stories, artwork, music, designs, sculptures, software, and more or less anything you can actually create in some form, but you cannot copyright ideas, you cannot copyright information, and you cannot copyright facts.

This has funny implications for fictional characters; see below.

Copyright is automatic. When you create something, you have copyright on it. You don’t have to use the © or whatever; if you make it, it’s yours. The © really just makes it easier to show a court that you’re the original creator, and might let you sue for more since the jackass ripping you off can’t claim ignorance. Speaking of which…


If someone violates your copyright, your only real recourse is to sue. And if you’re reading this instead of talking to your lawyer, you probably aren’t going to sue anyone. Oh and the amount you sue for is probably going to be pretty meager unless you’re rich or a corporation. Which makes this all kind of hilariously pointless in the end. Sorry.

Luckily, in practice, the kinds of people who run hosting companies and sites for hosting creative work are pretty interested in copyright, so you can probably just go up the chain of command and ask to have something removed without ever involving the legal system.

Work for hire

There is a single exception to the rule of automatic copyright: if you create something for your employer as part of your job, it’s called “work for hire”, and your employer owns the copyright.

Commissions are not work for hire; if you call it a “commission”, you’re not an employee. At best you’re an independent contractor, but that’s still not an employee—the only way a one-off work done on personal time could be considered a work for hire is if all parties involved sign a contract agreeing to such. And if you’re willing to do that, you should charge out the ass, because you’re selling your rights away too.

So when you get paid to create a one-off painting or story or drawing or song or program, unless otherwise specified in writing, you still hold the copyright and the buyer gets squat. You’re selling your time, not the work itself. Arguably the buyer has implied performance rights (and I suspect a court would agree), but the buyer does not have the right to modify it, the buyer does not have the right to sell copies of it, and above all the buyer does not have the right to tell you what you can do with it.


If copyright were truly limited to the original creator and no one else, the world would be a rather blander place. Which is why we have licensing!

A license is what it sounds like: permission to certain people to do certain things. As the creator, you have free reign to do whatever you want with your own work, but you can give other people license to do some of those things too. (By contrast, you’ve probably seen “all rights reserved”, which literally means “I’m keeping all the exclusive rights I have and you can’t have any of them.” This blurb was actually necessary to claim copyright, before 1976.)

Lots of licenses are informal. You might say “I made this, feel free to use it if you want.” It would make a lot of lawyers cry, but it’s a license given to everyone to do whatever they please with your work.

There are also formal licenses, like Creative Commons, which are designed to actually hold up in court.

To the best of my understanding, unless it explicitly says otherwise, a license can’t be revoked. Once you share your rights, you can’t take them back.

You’re also free to sell your copyright at any time to anyone else, as it’s your property to do with as you please. But if you do, you have zero special treatment over your work. If the new owner doesn’t grant you some rights with a license, you’re no different than anyone else. (It’s a massive tragedy that a great many record labels have contracts that grant them automatic copyright over the songs the artists make. Yes, many mainstream musicians don’t actually own their own music.)

Of course, since you hold the copyright and can do whatever you want, you aren’t bound by the terms of whatever license you give out. You can even give out one license to some people, and a different license to other people. A license only gives other people permission to do some of the things you’re allowed to do automatically. More on this in a bit.

Fair use

Fair use” refers to a brief list of excuses for copying someone else’s work, e.g. criticism, parody, research, reference, news reporting, and so on. The general idea is that there are legitimate types of work that are useful and necessary, but that can’t exist without copying someone else’s work. The rules are pretty fuzzy and pretty much up to a court’s discretion, though, so claiming “fair use” is unlikely to be a bulletproof defense.

Look at a copyrighted image on Wikipedia sometime, and you might see a fair use rationale given. It usually claims that (a) the article would be significantly less useful without the image, (b) the image is only a small low-resolution part of the entire original work, and (c) Wikipedia’s use of the image poses no real threat to the owner’s business model or reputation. Those are pretty much the criteria for successfully claiming fair use.

Delete ROMs after 24 hours

Yeah, no.

All that was just about how copyright actually works. What it is is not so much legal as philosophical.

Copyright originally lasted 14 years (with the option of requesting a single extension); now it lasts up to 120 years. 120 years! That’s so ridiculously long that we don’t even bother talking about copyright expiration any more, because it has zero practical impact on anyone who’s actually creating new things today.

Now we have this strange and self-contradictory culture of ownership. A lot of creators tend to feel very protective of what they create—after all, it’s theirs, and it will be for the rest of their lives. Yet, simultaneously, piracy is commonplace and at least moderately acceptable socially—how many artists have pirated Photoshop, how many musicians have pirated FL Studio, how many students have pirated Microsoft Office?

I think the difference is that people feel somewhat entitled to experience culture. If all of your friends are watching a show, it’s not just the creative output of some group of people any more; it’s part of your shared culture, and by not watching it, you’re missing out on something socially tangible. If every professional artist uses Photoshop (or, more likely, Sai) and you don’t, then not only are you missing out on a powerful tool, but you’re missing out on the vast resources and discussions constantly happening around you related to those tools.

In many cases, by not having access to very popular copyrighted material, it’s easy to feel that you are being actively denied something.

Which brings me (almost) to what I think copyright is, and which I suspect a lot of people intuitively feel about work that isn’t obviously created by a peer.

Without copyright, anyone’s work could be copied and freely redistributed or sold by anyone else. That’s not very nice of the rest of us, and would discourage people from creating things in the first place.

But! The point of publishing work in the first place is to share it with society, to contribute it to our culture at large. What is culture if not a distinct collection of creative works and ideas?

So the idea that a creator is owed multiple lifetimes of control over work sounds really weird to me. Copyright can’t just be a power grab.

Rather, I think copyright is a polite nod from the rest of us, to show our appreciation for having contributed to our culture. Cool, you made this; you can do what you want with it for a little while, but after that, it’s part of the collective consciousness and up for grabs.

It’s unfortunate that copyright term has been dragged out to absurd lengths, mostly to preserve portfolios of work created by people who are now long-dead. Lengthy copyright stagnates culture: the very companies with the resources to create lots of new ideas are encouraged to recycle instead, and no one else can give old work a new twist in the meantime.

This sort of belief is what produced the open source/free software movements.

Copyleft, copyfree, and software licensing

With the rise of computers, a strange problem arose. Previously, a “machine” was something mechanical, built out of physical parts. The design of a machine is an idea and thus can’t be copyrighted—it can be protected by a patent, but patents don’t prevent you from tinkering with your car in your own garage.

Software, on the other hand, is something we describe as being written. It’s considered creative work, and thus is subject to copyright. But unlike almost all other creative works, software can be compiled: you can run it and use it and appreciate it without actually being able to see what it is. You can fairly easily observe the strokes in a painting, the pixels in a digital drawing, the notes in a song, and the words in a story… but you can’t pop open progman.exe in a text editor and see what it’s doing.

You also can’t actually buy software. Since it has no (useful) physical representation, software exists solely as digital copies, and controlling digital copies is virtually meaningless. Instead, you are actually buying a license to use the software, which grants you an unintelligible list of rights. (That’s the legalese you don’t bother reading when you install something: the End User License Agreement, or EULA.) This is a question that never really came up before, as everything had always been distributed as a physical copy, but it’s getting a little weird as more work is sold digitally. Am I buying this ebook, or just a license to read it? Why can’t I sell that license like I can sell the physical book? To the best of my knowledge this is all still very gray legally; some courts have rejected EULAs as not being legally enforceable, there’s growing tension over the inability to resell digital work (like Steam games), and so on.

Where was I.

Right, so. “Free” or “permissive” licenses came as a reaction to copyright and the control it established over software. Developers who didn’t want their software to be locked up in a black box could choose to use a specific license that grants everyone the right to use and inspect and modify their software. In recent years we’ve seen the creation of such licenses for other types of creative work too, but permissive licenses for software in particular tend to require that the source code be made available, so users can see how the software they’re running actually works.

These are two major camps here, with a bit of friction between them.

A copyfree license allows anyone to do basically anything with your work. If there are any restrictions at all, they’re usually just that your name has to stay on any copies, modifications, or derivatives. The ISC license and CC-BY are copyfree licenses. (The term “copyfree” actually isn’t used very much; unlike “copyleft”, there isn’t much of an organized presence behind it.)

A copyleft license is one that allows anyone to do basically anything with your work, with the critical condition that anyone who releases modifications of your work must use the same license. The GNU Public License is the archetypical copyleft software license and the root of the whole idea of licensing away copyright; the equivalent Creative Commons license is the CC-BY-SA.

Both types of license tell the world that you created your work for their benefit, and they can do as they please with it from here. They promote a sort of freedom of ideas. But in the case of copyleft licensing, that freedom is enforced on anyone who wants to reuse the work. The difference is a question of your philosophy: do you support freedom more by enforcing it on others, or by giving others the freedom to not support freedom?

In the case of software, copyleft licensing is particularly controversial, because anyone who modifies your work must also give out the source code for their modifications. A lot of software shops are very protective of their source code and thus don’t take kindly to copyleft licensing—Apple, for example, forbids using it at all in anything they ship. And this is the intended effect of copyleft licensing: anyone who’s willing to play by the same rules can take advantage of a great amount of existing work, but anyone who’s not has to look elsewhere or start from scratch.

(Being protective of source code is a slightly strange thing. Copyright already protects it, and not having the source code doesn’t prevent anyone from bootlegging the finished product. I’ve even met plenty of e.g. homebrew developers who make a point of giving away little tools freely, but are still very protective of their code.)

A particular point of confusion that arises with these licenses is that of selling work. Remember, as the creator, you are never bound by the terms of the licenses you use anyway—but copyfree and copyleft licenses don’t forbid you or anyone else from selling work. However, since the licenses say that anyone can freely give out copies, it’s perfectly fine for one person to buy the work and then give it away to anyone else who wants it. There’s no such thing as piracy with permissive licensing, because you’ve given everyone permission to make all the copies they want.

To recap: if you use a permissive license, anyone can use, reuse, remix, copy, give away, or sell your work. I’m inclined to think permissive licensing has accelerated software development quite a bit, and I wish it were more popular in other fields. Maybe give it a try. Yeah, some jerk might sell mousepads of your work, but he was going to do that anyway. Think of well-meaning people and what they could create with more resources. And sell your own mousepads.

Public domain

Public domain is the realm of work whose copyright has expired. A public domain work thus has no owner, and everyone is free to do anything with it. (Government-created work can automatically be public domain under some circumstances I’m not qualified to explain, by virtue of being created by the public in the first place.)

Note that, at least in the United States, you can’t choose to put your work in the public domain. Public domain is defined only as where work goes after its copyright expires; there’s no legal mechanism by which you can discard copyright before it was set to expire. I doubt this will ever come up in court, since only the copyright holder can sue someone for violating copyright, and someone who tried to put something in the public domain is unlikely to then sue over it.

As a somewhat more robust alternative, Creative Commons offers the CC0 license, which just grants everyone everywhere a license to do absolutely anything. Software has the far more entertaining WTFPL.

Fictional characters

The copyright of fictional characters is an extremely gray area, and I’ve been unable to find any solid guidelines.

Strictly speaking, you can’t copyright a character, because a character is an idea rather than a work. So anyone claiming “my OC is copyright me” is already full of it.

That said, the legal system does recognize characters as being a part of the works in which they appear, and thus sharing in the copyright of that work. This requires that the character be distinct rather than just an archetype—again, the rules are pretty fuzzy. This is probably better left to human decency than to the legal system.

An interesting case that came up very recently was that a court ruled Sherlock Holmes (the character) to be in the public domain. Only some of the original Holmes stories have lapsed into the public domain, but the court felt that the first few books established the character, and thus the copyright on him expired with the copyright on the books, even though other original books starring him are still copyrighted.

What does this mean for, say, Superman? Copyright on the original Superman comics is due to expire in a few years. I guess we’ll see.

That's all I got

I hope this was at least moderately intelligible for anyone not familiar with the subject. Lemme know if anything is unclear or missing or outright incorrect so I don’t get sued for linking this to people who know even less about this than I do.

Final disclaimer: I mean “brief” in the legal sense, obviously.

[blog] Level 27

Another year gone by. I don’t think I even did one of these last year, but let me think about what I did while I was 26.

  • I lost a cat for the first time. It had… quite an impact. Later I adopted a new little buddy, Anise.

  • I bought a Soekris router and slapped pfSense on it. No, really, you would not believe what a nightmare this was to actually make work.

  • I did a whole bunch of Yelp-funded work on pyScss, turning it into a rather solid Sass compiler. I learned a good bit about parsing from this, which is cool since I’ve always thought it interesting but never found a good opportunity for getting my feet wet.

  • We (myself, my boyfriend, my girlfriend, and her husband) just moved to Vegas, which has been fantastic. The old house was co-owned by someone I’d gone to room with after moving out initially, and with the addition of my cluster (and accomanying menagerie) it had gotten a bit crowded. We finally got around to buying a new house in December, and it’s been pretty great so far; the house is cheap but huge (with a pool!), food is everywhere and also cheap, and the weather is rather a bit less dreary than Seattle.

  • I did a whole lot of technical tinkering and not a whole lot of releasing software and that is a shame. I’d really like to actually spit out some useful things this year. Fingers crossed.

Surely I’m forgetting something; that doesn’t sound like a lot. Okay yeah obviously buying a house is kind of significant, but it only ate a month. And I guess Styx’s declining health ate another month, during which I was largely a zombie. And pyScss was the only significant project I worked on for quite a while… hmm.

Seems like 2013 was a dreary void of a year for a lot of people. Even a millenium can’t escape being awkward and useless when it’s 13.

[blog] XY UI nitpicks

Game Freak, you are kinda bad at interfaces. Don’t get me wrong; Pokémon X and Y are absolutely the best in the series and even just showing the party Pokémon from within the bag is nothing short of genius.

But goddamn how does nobody working there notice these other things, some of which have been around since Red and Blue.

(Pretty light spoilers since this is just standard Pokémon gameplay stuff.)

  • When learning a new move and choosing which one to delete (in battle, anyway), there is no way to see the Pokémon’s stats. So if I’m choosing between a 60 power physical move and a 70 power special move, which is not uncommon… I can’t see if the Pokémon has better Attack or Special Attack. I often end up having to consult veekun to guess at the stats of the Pokémon that’s already out!

  • Getting from a move to its description (and damage class, ahem) in battle is ridiculously tedious. You can, of course, hold L and choose a move to see its properties. But this is never mentioned anywhere in the game, I’ve had this actually use the move once or twice, and anyway it doesn’t work if you have L=A turned on (and why wouldn’t you? one-handed mode wooo). Meanwhile, the X and Y buttons do absolutely nothing.

  • The bag has five pockets. Four of them are nicely organized.

    • Key items, of which there are probably a few dozen at most.
    • Berries, which can’t hold more than… 65, I think?
    • TMs, of which there are 108.
    • Medicine, which probably doesn’t exceed 50.

    That leaves the “other crap” pocket, which gets filled with the following:

    • 20 types of Pokéball
    • 18 Arceus plates
    • 18 type-boosting held items (Charcoal and the like)
    • 18 type-boosting gems
    • A dozen evolution items
    • At least 17 species-specific held items (Stick, etc.)
    • At least two dozen general-purpose held items
    • Some untold number of (ahem) the new item type introduced in XY
    • Fossils, shards, loot, Heart Scales, Honey, mail, and god knows what else.

    That’s over 200 items in one pocket, twice the size of the next-biggest.

  • The miscellaneous pocket of the bag no longer shows item grouping icons (like a Pokéball), which at least helped separate sections in BW.

  • Neither the bag nor the in-battle item menu show item icons any more. The held item on a party or boxed Pokémon doesn’t, either.

  • The “item” submenu on a party Pokémon offers to let me take or swap an item even from a Pokémon that doesn’t have one. It also doesn’t tell me what the item is before I take it, which is annoying when I’m trying to find where I left something like Amulet Coin or Lucky Egg.

  • Deposit” and “withdraw” on the Pokémon box system are useless. Using one or the other is slightly faster than going through “organize”, I guess, but anyone who runs with a full party of 6 (i.e. almost everyone) is going to want to do both together. It wouldn’t matter except that this is the one thing stopping me from merely mashing A to get to my boxes.

  • For some reason trading has two ways to show a Pokémon: press A, or tap a weird icon or something at the bottom I forget. The next step from either of these to actually offering a trade is a little different, and I can’t figure out why.

  • When viewing a party Pokémon, I can’t switch directly to my Pokédex and read a description of it. I have to remember its dex number and look it up manually.

  • There is no list of all moves or abilities I’ve seen. :( Shouldn’t the Pokédex track what abilities Pokémon can have?

  • The zoomed-out box grid view on the PC should really color each box icon according to its wallpaper. With 24 boxes this view is not very useful.

  • There are two (and a half…?) completely separate and distinct interfaces for deleting a move. There are at least two completely separate and distinct interfaces for seeing a Pokémon’s summary. This is a little silly, but it’s been the case for a while.

  • The summary view when perusing boxed Pokémon neither mentions its nature nor indicates which stats are raised/lowered.

  • Learning a new move and forgetting an old one involves some three separate prompts. If you change your mind about learning the new move, the button to abort is helpfully labeled “QUIT” and just restarts the sequence of prompts over—more than once have I just mashed A and accidentally agreed to learn it again. Why not just say “here’s a fifth move, pick which one to lose”?

    (That’s an annoyance in a lot of games, particularly RPGs: the button I mash to advance through dialogue is the same button I use to agree to choices offered in dialog. My 3DS has like a thousand buttons I’m pretty sure you can spare a second one.)

  • There are several places in the game where a list of items is intended to be scrolled by sliding on the touch screen, a la most phone interfaces (e.g. the bag, puffs in Amie), but either I’m a clumsy buffoon or something is not calibrated well because I very frequently end up tapping an item instead.

  • I miss the Habitat List. Please stop adding neat UI features in doomed branch games and not bothering to port them to trunk of the next generation. :(

So hey all those people with uncles and cousins that work at Game Freak who’ve come out of the woodwork since XY was announced: if you could pass this along that would be fantastic.

[blog] Cython versus CFFI

(This article has been translated into Russian by Everycloudtech—thanks!)

I have a hilariously unfinished Python module I work on from time to time named sanpera. It’s an imaging library for Python, with the vain hope that it might replace PIL someday. But this isn’t about sanpera.

sanpera happens to be powered by ImageMagick. I distinguish this from being an “ImageMagick wrapper”, as it explicitly has nothing resembling the ImageMagick API, because said API is insane. But this isn’t about ImageMagick, either.

Using ImageMagick requires binding Python to C, and that’s what this is about. There are several ways to use C libraries from Python:

  • Writing an extension module means the Python API is defined in C, so the library is used exactly as it was intended: with C code. Unfortunately this requires writing a lot of C, as well as a lot of careful Python refcounting. My C is passable, but I’ve done far more reading it than writing it, so this is not an appealing option.

  • ctypes is a standard-library module that can load shared libraries and call functions from them without the use of a C compiler or any new C code. Convenient, especially if you hate dependencies (in which case why are you binding to C?), but all the ctypes-powered code I’ve read has been tedious and fiddly and ugly.

  • Cython, a spiritual port/evolution/fork/something of the older Pyrex, is a language similar to Python that translates to C and then compiles into an extension module. Cython code can define Python classes and functions, but also call C functions and perform other C operations directly. Code with C semantics is translated fairly directly to C; code with Python semantics is translated to appropriate use of the CPython API; and Cython fills in all the bits to translate between the two.

I went with Cython because it looked interesting, it seemed to reduce the number of translation layers I’d have to care about, and it would even let me write hot loops (this is an imaging library) in C without actually writing any C. Plus, since it’s not actually Python code, it can compile to both Python 2 and Python 3 extension modules with very little effort on my part.

Here’s what Cython looks like:

[blog] dictproxyhack, or: ActiveState Code considered harmful

This is a story of how nothing in this story is my fault.

I’ve got a coworker who’s super into Clojure, a Lisp-like that runs on the JVM. In particular he’s super into how it’s got notions of mutability (and, thus, immutability) all throughout.

More than once he’s lamented that Python lacks a frozendict—a dictionary type that can’t be changed. Dictionaries tend to crop up a lot in Python, and in a very large codebase, it’s very easy to end up with this scenario:

  1. Some function somewhere generates a dict that’s only used by one caller. The interface is obvious since the keys and values are created right there in one place. No problem.
  2. Other code comes along, notices this handy function, and starts using its return value. Some of this code may pass the ad-hoc dict up to callers, too.
  3. Some of that other code needs more things added to the dict, but computing the extra data is expensive, so arguments are added to the function that optionally turn on certain keys.
  4. Some code needs even more things added to the dict that are outside the purview of the original function, so they add helper functions that take the ad-hoc dict and add more things to it.
  5. Since this has all now happened multiple times throughout your codebase, someone addresses the problem by writing adapter code that infers the original dict from some other object describing its structure, thus saving everyone from writing all these functions that return dicts.

A lovely spaghetti dinner. It’s now nigh impossible to trace what the dict contains or where half of it came from.

Returning an object in the first place would have avoided much of this, but when you’re sitting at step 1, that seems like a lot of effort just to return half a dozen things from a function you wrote to another function you wrote. Swapping out dict() for frozendict() is easy.

My opinion on frozendict had never grown stronger than “I guess that would be cool”, so I never sat down and wrote the class, and there must be enough subtleties that nobody else at Yelp has either.

Then today, PEP 416 came to my attention. This PEP proposed adding a frozendict type, but was rejected last year as being largely unnecessary. What’s interesting about it is that the rejection ends with almost a footnote suggesting that perhaps dictproxy ought to be exposed to Python-land, instead. And indeed this was done, and it exists in Python 3.3.

[blog] I bought a new laptop

Wow, where the hell have I been.

That whole “dying cat” thing ruined most of my April, and I spent most of May dealing with various other life crises, and then June scrambling to catch up. I’ve started and abandoned maybe half a dozen posts in that time that I will totally maybe finish someday. In the meantime, here’s something aimless and specific to me about how I bought a thing. Par for the course, then.

[blog] The controller pattern is awful (and other OO heresy)

Almost a year ago now, Jack Diederich gave a talk entitled “Stop Writing Classes“, in which he implores Python programmers to stop creating classes just for the hell of it, and specifically calls out the common pattern of a class with only a constructor/initializer and a single method—which should, of course, just be a function.

A few weeks ago, Armin Ronacher wrote a rebuttal entitled “Start Writing More Classes“, which argues that classes are essential for both writing extensible code and smoothing over crappy interfaces. (Hm. Now that I look at it again, if you read the post backwards, it almost sounds like he’s suggesting writing a class to smooth out the crappy interface you get from using too many classes…)

I’m having some trouble here, because I agree with both points of view. There must be a way to resolve this contradiction, a message that resonates with everyone.

I think I’ve found it.

Stop writing stupid classes.

[blog] Suzanne Venker is a robot alien in disguise

It’s my best guess. It would explain some things.

She has written another charming opinion piece and I can’t resist butting my big dumb head in to object to a few things here.

(The article was originally accompanied by a thumbnail of a happy couple in typical wedding garb kissing with a cool skyline background. Minor oversight: both of them were women, which sort of contradicts the article’s title in a number of hilarious ways. Strangely, this illustration has now vanished!)