Social media and hospitality

I'm thinking about *hospitality*, and social media. Every social media site I've used (and services more broadly, really) encodes certain notions of hospitality. When you post something, you are inviting certain people into your space, based on the site you're using and who can see it and the ways they can interact with it or…

Fun times with unittest.mock

In foo.py: [code lang="python"]from qux.bar import Baz def some_fn(arg=Baz): # Something involving arg() pass[/code] In test_foo.py (running under pytest, with pytest-mock): [code lang="python"]from .foo import some_fn def test_some_fn(mocker): mocker.patch('foo.Baz') # Oh no, tests don't mock it out right![/code] It took me a tick to realize that the function definition was being evaluated at import time,…

Getting your docs on Read the Docs

You've seen it before: software projects with lucid and lovely documentation, all available on subdomain.readthedocs.org. So, how do? Well, the good folks at Read the Docs have made your life very easy. Assuming your documentation's reStructuredText source is kept in git, and you are OK with pushing it to GitHub, you can get Read the…

Let’s talk about Sphinx

I've fielded a few questions lately from folks about Sphinx, reStructuredText, and documentation in the Python world and more broadly. So I thought I'd write up a bit of an intro to how I use and understand these tools, and how better documentation makes me a better developer. Restructured understanding of reStructuredText There's a lot…

Defense against the Dark Arts

I've just been reading Carole Cadwalladr's excellent journalism on the subject of Robert Mercer, Cambridge Analytica, and the Brexit and Trump votes. You can see the articles here and here. They're chilling, and upsetting, and important. At some level, what Cambridge Analytica is doing is something familiar: propaganda. It's different in two respects, though: one,…

Great American Institutions

This country likes to talk at length about how much it values democracy, as a core concept. For a long time, I've said that this strikes me as strange, when two out of three of our major cultural institutions are (mostly) based around (substantial) autocracy. That is, while we pursue democratic government, we maintain autocratic…

The End of the Third Age

I’m going to talk about the Lord of the Rings. Or maybe America, at this juncture in time. Tolkien, famously, hated allegory and rejected allegorical interpretations of his work. And yet, time and time again, people have found an allegorical reading of his Lord of the Rings inevitable and tempting. There are plenty of reads…

South Pacific

I grew up listening to a lot of Rodgers and Hammerstein; it was some of my mother's favorite music, and so there was a lot of it in the house. More than any other musical of theirs, I listened to South Pacific. Now, there are problems, of course, with that show. It's a product of…

Craft and writing prose

Prose is important; even if you’re writing for no one else, you’re writing for yourself in the future. The best developers I know write a lot of prose, both documentation and commit messages and comments. The value is not immediately visible, it won’t make your tests pass, but it actually is part of keeping technical…