This is a very long essay in which I try to think through the implications of Python 3.5's new async/await support for how we write asynchronous code. (Spoiler: I think curio has a lot to teach us.)
Emerging from the underworld
SciPy this year was awesome – there's so much wonderful stuff happening in the community, and I had lots of great, productive conversations about how to move forward on different projects that I'm really excited about. ...and then immediately afterwards, I pretty much dropped everything on the floor and disappeared for 3 months, including cancelling several talks and trips. Some people know part of why, but I definitely haven't been as good about keeping my friends and collaborators updated as I'd like to be. So here's an update.
The short version: the week after SciPy I had a minor surgery scheduled, and that went fine – but then afterwards, instead of recovering, I just got sicker and sicker. I couldn't eat – I lost 30 lbs in 60 days – I was feverish and in pain and sleeping 12-16 hours a day, anemic... among other things. If you imagine having food poisoning continuously 2+ months then you won't be too far off.
The good news is that after much medical wrangling (so much medical wrangling), I finally have a diagnosis. The not-so-great news is that it's ulcerative colitis, which is a fairly serious, chronic, auto-immune disorder in which my immune system periodically tries to kill my large intestine. There's a lot of variation in the long-term effects: for some people it's a minor annoyance, and for others it's a permanent severe disability. There's every reason to hope that once I'm out of this massive flare triggered by the surgery etc. then I'll turn out to be on the milder end of the scale (and in retrospect, I'm suspiciously eyeing some past events as signs that I might been having mild symptoms that evaded diagnosis for quite a long time). But realistically, it'll take months or years before I know for sure where I fall.
For now at least, it's good to know what's going on, and I'm responding well to treatment. I'm feeling much, much better. Still not 100%, and I'm trying to ease back into things slowly to avoid over-extending myself and triggering a relapse (hello, spoon theory).
To everyone who's been waiting for a response or followup from me on something: I'm very sorry for disappearing like this. I'm starting to work through my disaster zone of an inbox, and realistically it's going to take some time to get on top of things. I may have to make some tough choices about dropping previous commitments, or asking folks to cover for me – but at least I can do a better job communicating that. I also don't mind if you send me more email or pings or whatever – if anything, it helps to triage. Just FYI though that even though I'm doing somewhat better, I'm still going to have limited bandwidth for a while. Thanks for your understanding and patience! I'm looking forward to getting through this and back to working on more awesome stuff.
Stochastic descent
Emacs has a lot of stuff in it. Like, really, a lot. Most of the time it doesn't matter, you can just use whatever bits you know and be happy, but there's always more to learn.
For example, here's a thing I often want to do: starting from whatever file I have open, open the directory containing that file.
So my fingers have memorized the sequence: C-x C-f C-j
(For the uninitiated, that's emacs-ese for "while holding down the control key, press X F J in that order".)
This breaks down as:
C-x C-f: this runs the find-file command (or actually ido-find-file in my case), and causes emacs to ask for the name of a file to open.
C-j: The prompt opens with the current directory filled in as the initial value, so this says "yes, I want that". It's like hitting enter, except that if you just hit enter without having typed anything then emacs figures you made a mistake and want to cancel out; C-j skips that logic and accepts the default.
(Allegedly, this is intuitive: C-j often does something similar to hitting enter in emacs, and in other classic terminal tools. This is because in ASCII, the newline character has character code 10, J is the tenth letter of the alphabet, and on old-school terminals the "control" key was a modifier where hitting the Nth letter of the alphabet would send the raw ascii control code N. You see: intuitive. Looking at the ASCII table, then this also explains why your terminal sometimes freaks out when trying to distinguish between C-h and backspace [1], why C-d in unix command-line tools means end-of-file, why C-g is traditionally used for interruptions, and why Windows files on Unix sometimes end up displayed with ^M crud. The more you know 🌠)
Anyway, I've been typing C-x C-f C-j multiple times a day for, uh. 15 years now? Probably more?
Last night I missed a keystroke, and accidentally typed: C-x C-j
And it worked!
It turns out that C-x C-j is dired-jump, which opens a dired buffer for the directory containing the current file, and then puts the cursor on top of that file. So actually it works even better than C-x C-f C-j, which doesn't do that last part. (Also, if you're already in a dired-buffer, C-x C-j takes you up to the parent directory.)
I never knew this existed, even though it's been lurking there forever, just 1 Levenshtein distance away. As far as I know, the similarity is a complete and utter coincidence – one "j" is short for "jump", and the other is short for "the tenth letter of the alphabet".
I've probably used it 20 times since last night.
[Update, 2016-10-29: I'm informed that the C-x C-j key binding isn't present by default, but requires that you have loaded the dired-x package. You can do this by adding some autoload nonsense to your .emacs, or just (require 'dired-x). While you're at it you should turn on dired-omit-mode, which is apparently why I had dired-x in the first place.]
(While we're here, a random bonus emacs tip that also took me wayyyy too long to discover: in dired-mode, try hitting C-x C-q. It makes the buffer editable, so you can go around and change the text so that it looks like it's describing the directory that you wish you had – you can rename files, use search-replace, whatever – and when you hit C-x C-s, emacs will go and rearrange the real files on disk to match your changes. Plus, if any of those files are open in emacs, then the buffers will be automagically redirected to point to the new name, so you avoid the annoying thing where you rename the file in the terminal and then the next time you save emacs puts it back where it was before.)
[1] | Do please appreciate the Wikipedian who labored over this page's illustrative figure + caption. |