Subzero

Python has this elegant destructuring-assignment iterable-unpacking syntax that every serious Pythonista and her dog tends to use whereëver possible. So where a novice might write

split_address = address.split(':')
host = split_address[0]
port = split_address[1]

a serious Pythonista (and her dog) would instead say

host, port = address.split(':')

which is clearly superior on grounds of succinctness and beauty; we don't want our vision to be cluttered with this ugly sub-zero, sub-one notation when we can just declare a sequence of names.

Consider, however, the somewhat-uncommon case where we have an iterable that, for whatever reason, we happen to know contains only one element, and we want to assign that one element to a variable. Here, I've seen people who ought to know better fall back to indexing:

if len(jobs) == 1:
   job = jobs[0]

But there's no reason to violate the æsthetic principle of "use a length-n (or smaller) tuple of identifiers on the left side of a destructuring assignment in order to name the elements of a length-n iterable" just because n happens to be one:

if len(jobs) == 1:
   job, = jobs

Group Introduction Redux

(Previously.)

I'm pleased to introduce the five of you to start off the App Academy mentorship program. Zack -- meet [redacted 1], [redacted 2], [redacted 3], and [redacted 4], your mentees from the March 2016 cohort.

You'll have a chance to meet in person this Thursday at the mentorship kickoff [...] Until then, please send an email introducing yourself to your mentor/mentees, including what you did before App Academy, your favorite part of writing code, and what you like to do for fun (besides writing code).

[...] I think my favorite part of writing code is the vertiginous terror of manifesting machinery out of pure ideas, summoning thought-engines from the underworld with unknown lives and dollars hanging in the balance and protected only by the clarity of one's understanding, and the clarity of understanding of the ones who wrote the tools built on tools built on tools extending thirty layers deep into the underworld on which the fictive ontology of our existence carefully rests, praying that the test suite is comprehensive, knowing that it isn't, hoping that the fullness of your thought in its obvious righteousness doesn't need it and that the customers and investors and hypothetical ascended children's children's children would smile on this moment, judging that you have brought honor to this endeavor, the last human profession.

I would like to be able to tell you what I did before App Academy, but unfortunately, everything in my life before December 2013 is non-canon. Similarly what I do for fun. In any case, I have the honor to be,

Your obedient servant,
Zack M. Davis

Islands

(an office on the someteenth floor)

"So this is what it feels like to die."

(A beat.) "I'm skeptical of the claim that you're dying."

"If I can't solve our own take-home interview problem, then there's no reason for the global economy to continue to keep me alive. It's not a quick death, but ..."

Genesis

In the beginning, God created the heavens and the earth. And the earth was void and formless, and darkness was upon the face of the deep, and the spirit of God floated over the waters.

And God said, "Markets in everything."

And there were markets in everything.

Colony

"I've got to say, from one colony-of-intelligent-information-patterns-in-the-process-of-annexing-a-primate-brain to another, you're a really cool guy."

"Uh, I'm not sure I understood that first part. And I'm not a guy."

"Shh! Don't say that where my host organism might hear you! It might get ideas, and no one wants that."

Scoop Me Out of the Bargain Bin

If you're on a shoestring budget, look for factory rejects
You get the greatest models, just with one or two defects
Take me, I'm bright, hard-working, and will stick for the ride
Though with emotional stability six sigmas to the side, wo-o-oah

Scoop me out of the bargain bin and let me at the world
Scoop me out of the bargain bin and I will be your go-to girl
It's real, I'm such a steal, going for half the normal price
Scoop me up, I'm a bargain for such high-class merchandise

If You Had to Choose

"I just want a guy who's kind, and smart, and handsome, and truly understands the depths of my very soul," she said. "Is that too much to ask?"

"Yes. Pick two," said her older and wiser friend, who had studied the question. "And not the truly-understands-the-depths-of-your-very-soul one."

Missing Refutations

It looks like the opposing all-human team is winning the exhibition game of me and my it's-not-chess engine (as White) versus everyone in the office who (unlike me) actually knows something about chess (as Black). I mean, naïvely, my team is up a bishop right now, but our king is pretty exposed, and the principal variation that generated one of our recent moves (16. Bxb4 Bf5 17. Kd1 Qxd4+ 18. Kc1 Ng3 19. Qxc7 Nxh1) looks dreadful.

Real chess aficionados (chessters? chessies?) will laugh at me, but it actually took me a while to understand why Ng3 was in that principal variation (I might even have invoked the engine again to help). The position after Ng3 looks like

    a b c d e f g h
 8 ♜       ♜   ♚   
 7 ♟ ♟ ♟     ♟ ♟ ♟ 
 6                 
 5           ♝     
 4   ♗   ♛         
 3 ♙           ♞   
 2   ♙ ♕     ♙ ♙ ♙ 
 1 ♖ ♘ ♔     ♗   ♖ 

and—forgive me—I didn't understand why that wasn't refuted by fxg3 or hxg3; in my novice's utter blindness, I somehow failed to see the discovered attack on the white queen, the necessity of evading which allows the black knight to capture the white rook, and preparation for which was clearly the purpose of 16. ..Bf5 (insofar as we—anthropomorphically?—attribute purpose to a sequence of moves discovered by a minimax search algorithm which doesn't represent concepts like discovered attack anywhere).

Continue reading

Mirage

(just some quick notes, hopefully in the spirit of delightfully quirky symmetry-breaking)

In her little 2010 book The Mirage of a Space Between Nature and Nurture, Evelyn Fox Keller examines some of the eternal conceptual confusions surrounding the perennially popular nature/nurture question. Like, it's both, and everyone knows it's both, so why can't the discourse move on to more interesting and well-specified questions? That the oppositional form of the question isn't well-specified can be easily seen just from simple thought experiments. One such from the book: if one person has PKU, a high-phenylalanine diet, and a low IQ, and another person doesn't have PKU, eats a low-phenylalanine diet, and has a normal IQ, we can't attribute the IQ difference to either diet or genetics alone; the question dissolves once you understand the causal mechanism. Keller argues that the very idea of distinguishing heredity and environment as distinct, separable, exclusive alternatives whose relative contributions can be compared is a historically recent one that we can probably blame on Francis Galton.

The "Bay Area" was ostensibly hosting the big game this year. They blocked off a big swath around the Embarcadero this last week to put on Super Bowl City, "a free-to-the-public fan village [...] with activities, concerts, and more." I really don't see how much sense this makes, given that the actual game was 45 miles away in Santa Clara, just as I don't think we (can I still say we if I only work in the city?) really have a football team anymore; I like to imagine someone just forgot to rename them the Santa Clara 49ers. Even you don't think Santa Clara is big enough to be a real city—and it's bigger than Green Bay—then why not San Jose, which is a lot closer? I think I would forgive it if the marketers had at least taken advantage of the golden (sic) opportunity to flaunt the single-"digit" Roman numeral L (so graceful! so succinct!), but for some dumb reason they went Arabic this year and called it Super Bowl 50. Anyway, on a whim, I toured through Super Bowl City after work on Friday. It was as boring as it was packed, and it was packed. I wasn't sure if my whimsy was worth waiting in the throng of people to get in the obvious entrance on Market Street (the metal-detection security theater really took its toll on throughput), but I happened to hear a docent shouting that there was a less-crowded entrance if you went around and took a left each on Beale and Mission, so I did that. There were attractions, I guess?—if you could call them that. There were rooms with corporate exhibits, and an enormous line to try some be-the-quarterback VR game, and loud recorded music, and a stage with live music, and an empty stage where TV broadcasts would presumably be filmed later. There was a big statue of a football made out of cut-up beer cans near one of the stands where they were selling beer for $8, which sounded really expensive to me, although admittedly I don't have much of a sense for how much beer normally costs. In summary, I didn't see the appeal of the "fan village," although I do understand what it feels like to be enthusiastic about the game itself—I really do, even if I haven't been paying much attention in recent years.

Continue reading

"I Have the Honor to Be Your Obedient Servant"

A friend of the blog recently told me that I'm meaner in meatspace (what some prefer to call by the bizarre misnomer "real life") than you would guess from my online persona. I'm not proud to have prompted this observation, but I didn't deny it, either. And yet—insofar as one has any reflectively-endorsed non-nice social impulses (to create incentives for good behavior, or perhaps from an ungentle although-sadistic-would-be-far-too-strong-of-a-word æsthetic that appreciates a world in which people don't always get everything they want), it does seem like the correct strategy: in meatspace, you can react to verbal and nonverbal cues in real time and try to smooth things over if you go too far, whereas in the blogosphere, it's possible to die in a harrowing thermonuclear flamewar and not even know until you check your messages the next day. We must use diplomacy where we cannot wield our weapons so precisely.

Quotations IV

MISTY: You know, I usually burn incense when I meditate, but the smell of a burning city can be just as relaxing.
JENNY: People are in danger! Why don't you do something?!
MISTY: They stiffed me.
JENNY: What?
MISTY: Your town. Tremorton. They wouldn't cough up the cash for services rendered.
JENNY: I have no idea what you're talking about.
MISTY: I'm a hero for hire. I save people for money. You knew that.
JENNY: And if they don't pay up, you just let them get pummeled?
MISTY: Pretty much. I have to eat, don't I?
(JENNY flies away, disgusted)
MISTY: I'm not living with my mom, like some people!

My Life as a Teenage Robot, "Mist Opportunities"

A second way of interpreting the effort level eMIN is to consider that the principal and the agent do not have completely conflicting objectives. It is possible that the agent gets some utility from his work, but only up to a certain effort level. We assume that the level that the agent is willing to spontaneously offer is eMIN. The agency problem turns up in this case since the principal would like the agent to offer an effort greater than his spontaneous level.

—Inés Macho-Stadler and J. Davis Pérez-Castrillo, An Introduction to the Economics of Information

Continue reading

Two-Point Compersion

"I don't get it."

"Yeah, I guess the rules are kind of complicated, but—"

"No, I mean, I think understood the literal content of your explanation, but I don't understand how the behavior you describe could arise from the rules as stated. What stops teams from just cooperating with each other?"

"Cooperating? What do you mean?"

"You say advancing the ball to the other side of the field is a touchdown worth six points?"

"Yes, plus a point-after kick or two-point conversion attempt."

"So why don't the teams just take turns scoring touchdowns?"

"What? Why would they do that?"

"To score points. You said that was the objective of the game."

"Oh, ah—I didn't realize I needed to explain this part—the goal is to get more points than the other team. The team with more points is called the winner of the game, and the other team loses."

"So it's a zero-sum game?"

"Well—yes."

"But that's barbaric!"

"That's ... not usually the reason people call football barbaric."

"Lower animals fight over fixed resources, the power to create opportunities lying far beyond their abilities and even their concept-space. But you, living at the dawn of your world's intelligence, you have the rare opportunity to build new worlds—and share the proceeds between you. And you waste your energy on this contrived imitation of a payoff matrix that it is your birthright to supersede! It is revolting."

The Seat Thief's Rationale

What is even the motivation for stealing a bicycle seat? How much can you hock it for?

I think I would forgive it if some poor soul had stood here after glancing around furtively to confirm that the train cops were absent, and computed: "Taking this seat will ruin the evening commute of some rich person, and likely the eight commutes after that, but he (probably he) can take it, whereas I need to sell this seat to get the money to buy the drugs to sell the drugs to get the money to buy the bread to feed my starving family—clearly a Kaldor–Hicks improvement, and after my drug-dealing startup takes off, I'll be sure to spend the occasional Monday evening replacing missing seats at a train station bike rack not unlike this one."

TODO I

    let path = Path::new("/proc/meminfo");
    let proc_meminfo = match File::open(path) {
        Ok(f) => f,
        Err(e) => {
            println!("Error: {:?}", e);
            // TODO: be kinder to our friends still under Cupertino's rule
            moral_panic!("couldn't read /proc/meminfo?! It is possible \
                          that you are struggling with an inferior nonfree \
                          operating system forced on you by your masters in \
                          Cupertino or Redmond");
        }
    };

Missing Words VII

We need a word or phrase to refer to intentionally (and usually only slightly) misquoting something for the sake of a perceived æsthetic improvement in the context in which the quoter wants to use the material. Okay, we do have the word paraphrase, which is close ("To paraphrase the great fooer Bar Quux ..."), but I don't think that's quite it—the Wiktionary definition mentions "often to clarify meaning" and I'm definitely talking more about petty differences in word choice than actually clarifying meaning.

There's this wonderful quote by Eugene Gendlin that I often remember as "People can stand what is true, because they are already doing so," but it turns out that Gendlin's actual phrasing was "for they are already enduring it." If I want to use my slightly different choice of words because I think it flows better in the context in which I'm repeating it, I think that can be legitimate. (Although needless to say, in formal settings, you definitely only want quotation marks around the words someone actually said.)

Or if my hypothetical pop punk band (which would hypothetically be called either "Bullet Candy" or "Zack M. Davis and the Duty-Bound Empiricists") were to cover Taylor Swift's "The Story of Us", I would sing part of this one line in the chorus as "the twist of fate by which it all broke down" rather than the original "the twist of fate when [emphasis mine] it all broke down," not to suggest Swift was wrong to sing when, but rather because that kind of use of the phrase by which is exactly the sort of rhetorical flourish that my hypothetical band would hypothetically be known for.

Voicemail Greeting

(circa 2005)

You've reached the voicemail box of Zack M. Davis
I say that in case this is a wrong number
And you want to know what his name is
But he cannot talk to you right now
No he's got other things to do right now
So he cannot talk to you, leaving you alone
But you can leave a message after the tone