An awkward thing about programming in Python: there are lots of
double underscores. For example, the standard method names beneath the syntactic
sugar have names like __getattr__, constructors are __init__, built-in
operators can be overloaded with __add__, and so on. In the
Django framework (at least
before they integrated the magic-removal branch), the object-relational mapper
used keyword arguments named things like user__id__exact.

My problem with the double underscore is that it's hard to
say. How do you pronounce __init__? "underscore underscore init underscore underscore"?
"under under init under under"? Just plain "init" seems to leave out
something important.

I have a solution: double underscore should be pronounced "dunder".
So __init__ is "dunder init dunder", or just "dunder init".

Comments

FWIW, I usually pronouce these constructors as "under under" , and leave off the trailing "under under" (at least when talking to other Python folks). So I'll say "under under init" when talking about __init__, and usually it comes out phonetically like "unnerunner init".

Bob, I think Ned was using Dunder as a noun that described the two underscores not an adjective that describes text flanked by double underscores? Since it's the former I think your first __Mifflin is correct. That means there's an opportunity to create the adjective. I propose dunderuf.

It looks like I'm not the coiner of "dunder". D'oh! Still a good idea (maybe even a better one)!

Ben Finney 10:08 PM on 22 May 2006

I have a problem with this protocol; it doesn't unambiguously differentiate between __foo and __foo__. If you ask me to look for "dunder foo", which one should I be looking for? Worse, if you ask me to *implement* "dunder foo", which name should that resolve to?

Dunders must die. It's a notion for "special" attribute, which shouldn't be used directly in a user-space code, except for very well known cases, such as __init__. So all you library writers abuse us, library users, when you want us to use "dunders".

Graham 4:25 PM on 23 May 2006

Bob: "Now that we have that cleared up, maybe we can standardized how we should say www: double-u, double-u, double-u, dubya-dubya-dubya, dub-dub-dub, triple-dub, wuh-wuh-wuh....."

I had always hoped that "sextuple-you" would catch on. It's just so suggestive, and less than half the syllables. ;-)

As for the ambiguity of double-scores at one or both ends, how about "dunder foo" for __foo and "dundunder init" for __init__? It's got alliteration and recursion going for it, if nothing else!

Graham:
> how about "dunder foo" for __foo and "dundunder init" for __init__?

I kinda like "dunder" and, simply, "dundun".

(For www, I'm a huuuge fan of "many-u".)

Michael Chermside 8:53 AM on 25 May 2006

I do just what Chris does: "under-under init" means "__init__". I rarely ever need to refer to something like "__x" because I just don't use leading-double-underscore-without-trailing-double-underscore. But when I do, I pronounce it "underscore underscore ex" -- the abreviation from "underscore underscore" to "under under" implies trailing as well.