fuzzy notepad

this is really hard to write on

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.

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:

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.

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.

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.

Cython versus CFFI

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:

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.

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.

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.