Another No Baking Sunday

I’d like to blame the hand. It’s healing nicely:

It’s still weak, lacking in range of motion, and I’m worried about regression.

I’m just mopey. Which is a deprecating way of describing a certain sort of ineffectuality I experience. It’s often associated with depression (it makes things hard to do) and with anxiety (anxiety about doing things makes no doing anything more pleasant to do).

I did get a bit of a walk yesterday and saw a cool outdoor budgie aviary:


RIP Aretha Franklin

She had a fascinating life and was a world historical artist.

I had a secret fantasy that Aretha would one day perform “The President Sang Amazing Grace”. I was especially interested in her accompanying herself on the piano as sh was a great pianist as well as singer.

Python Class and Instance Methods Share a Namespace

Which sucks.

Coming from Smalltalk, I expect a lot of polymorphism. Class/instance polymorphism seems pretty obvious…if I send a message to a class it goes to the class for handling. If I send a message to an instance it goes to the instance for handling. the methods can be different for each.

This is really useful for cases where much of the time you have a “fire and forget” method (e.g., serialising an object) for which you want to hide the effort of dorking with an instance in the normal case but sometimes you want to reuse the object. This just happened to me!

class BlackboardDelimitedSerialiser(ExamVisitor):
    def serialise_to(self, exam, path):
        with'r') as f:
            writer = csv.writer(f, delimiter='\t', dialect='excel', quoting=csv.QUOTE_NONE, escapechar='"')
            for q_row in self.visit(exam):

To use this as a one off I have to first instantiate the object. So something like:

bbserialiser = BlackboardDelimitedSerialiser()
bbserialiser.serialise_to(exam, path)

Since in my command line tool, I just do this serialisation once, I hoped to add a convenience class method:

class BlackboardDelimitedSerialiser(ExamVisitor):
    def serialise_to(cls, exam, path):
        serialiser = cls()
        serialiser.serialise_to(exam, path)

    def serialise_to(self, exam, path):
        with'r') as f:
            writer = csv.writer(f, delimiter='\t', dialect='excel', quoting=csv.QUOTE_NONE, escapechar='"')
            for q_row in self.visit(exam):

So my call site would look like:

BlackboardDelimitedSerialiser.serialise_to(exam, path)

But all methods share a namespace so the instance method (which is lexically last) wins.

Boo! I don’t want the names to be different! I started hacking on clever, horrible tricks when I realised that I was being completely daft for this case. If I just add instantiating parens, the call site looks like:

BlackboardDelimitedSerialiser().serialise_to(exam, path)

So my use case was bad. There’s no need for a class method so better not to have the extra method. This won’t be true for other cases (where I need some extra logic in the class method), but let’s not borrow trouble. After all, it’s not even clear that I’ll ever need to reuse the object, so having the class method and an uglier name for the instance method would be fine.

People Know the Better and Do the Worst

One of Socrates’ puzzles is whether there can be real “weakness of will” that is whether people can know what’s better and chose what’s worse.

Of course, Plato is aiming at a conceptual move wherein whatever we select we believe is the better. But I’m gonna stick with the common sense version.

Prominent, experienced feminists writing a letter which enacts a fair number of standard bullshit moves in defenses harassers everywhere is my current go to example.

I know we are flawed cognitive-affective machines so in some sense this doesn’t surprise me. But it still breaks me a little.

CSS Misalignment

Well, here we are in day n of trying to add a simple logo to a showoff presentation. Showoff has a very neat feature set (esp for audience interaction) but is pretty garbage to dork with.  I mean, most HTML slideshow systems are, but showoff is screwing me pretty hard.

My current solution is to add the image to the content Markdown. That at least gets me somewhere even if I have to preprocess the Markdown. BUT, the image is aligned centre and I need it on the left. Now usually getting things to align centre is challenging for CSS with garbage like “margin-left:auto; margin-right:auto” being actual canonical moves (unless you are dealing with text or floating an image). Of course, I can’t use something like “align: left” but am off in some rathole of position, float, margin nonsense.

CSS has been around in some form since 1994. 1994. They’ve been deprecating HTML presentation stuff for quite some time now. But it’s just plain worse.

Now I’m sure if I spent enough time really learning all this shit, I would have some reasonable control. But…I don’t want to have to learn all this shit just to do some basic layout and I shouldn’t have too. LaTeX I sort of forgive just for it’s shear age, but 1994! With supposed active development since!

It makes me want to dork with transparent 1 pixel gifs.

Thinking About Bug Day

Grace Hopper discovered the “first” computer bug…a literal moth shorting out some relays. (I scare quote “first” because, like many “first”s, it’s complicated; I’m more than happy to credit Hopper though esp as it makes such a fun story and it involves an actual, biological, bug.) Last year was the 70th anniversary of her discovery and the folks at BugSnag put together a nice, if short, series of “worst bugs in history” with a focus on older ones with big property/life effects. It lists some classics which probably had an oversized effect in the literature (eg Ariane 5). Unit conversion issues figure prominently and still are poorly handled.

Bug day is Sept 9th which is inconvenient for my class. It’d be nice to have some sort of more wide spread…celebration? Event? Reflection?

OTC Differences

One of the more amusing quirks we observe having moved the UK from the US (a looong time ago, now) is differences in what’s legal (or common) to sell over the counter without a prescription.

One of my go to drugs (back in the day, it’s become less effective for me for headaches and I don’t need it so much otherwise) is Naproxen. For a long time I thought it was just unavailable because no one marketed it, but it turns out that it needs a prescription in the UK! And yet you can get Tylenol with codeine OTC in the UK!

(I really have to track down that decision making.)

After reading a pretty comprehensive article on melatonin, I was frustrated from trying it out because it’s not OTC in the UK, whereas you can as easily get 5mg and 10mg pills (which seem all the wrong doses) in the US as vitamin C tablets.

One thing that hit me searching for melatonin in the UK was how depressing supplement stores are. It’s almost certainly the case that most of the normal stuff (like vitamin C tabs) is worthless for most people in most situations, but the more elaborate stuff is all snake oil. Or fish oil, as it turns out.