Dunderrr
Student Login

Dunderrr

Did you know Python has a secret word?

It's a word called "dunder". You might know about this... it's more of a secret outside our community.

But it points out something FASCINATING about how humans think.

Before explain, here's what "dunder" means, in case you don't know:

Python classes have lots of special method names with two underscores in front and two in back.

Like "__init__". Or "__call__". Or "__add__".

Python has dozens of these. They're called "magic methods" - you can look that up.

The annoying part is when you're SPEAKING to another Python developer, and you have to say "underscore underscore init underscore underscore".

Dear God. So many syllables. Who has that kind of time?

Not highly intelligent, heart-breakingly attractive, in-demand Python developers!

So the Python community invented a special abbreviation. A VERBAL abbreviation.

That's the word "dunder". When I say "dunder foo", that means "underscore underscore foo underscore underscore".

Saves lots of time!

The interesting thing is that you only need this when speaking. When you write, you don't write "dunder foo". You just write "__foo__", because it's accurate, and easy to type. You only need this abbreviation when speaking, not writing.

This is a perfect demonstration of something I figured out long ago... A profound principle of the human mind...

Which I won't talk about here.

For now, I'll point out that you can do some interesting things with magic methods when you follow the rules...

And you can do some FASCINATING AND AMAZING things with them, when you DEFY the rules.

So how do you "defy the rules" with Magic Methods? Or learn about this mysterious "profound principle of the numan mind"?

Newsletter Bootcamp

Book Courses