Is Harry Potter Dancing to Python?

We can’t be that serious all the time, honestly? Therefore a short post with some nonsensical thoughts. Yesterday I viewed Harry Potter & The Deadly Hallows for the N’t time, enjoying my favorite Belgian beer and after a while my thoughts drifted off. The following associations came to my mind: how dreadful dance scenes where in the books as well as in the motion pictured version of this saga. Dancing- and dancing lessons must definitely be portrayed as a most traumatic experience by Mrs J.K. Rowling. Compared to eating at least. Meals in Harry Potter’s world must always be a real festive affair. I imagined that reading of Harry Potter books is highly recommendable while treating anorexia cases. Likewise, clumsy boys will certainly be delighted to learn that dancing isn’t that much fun as is always told. Albeit that girls might probably enjoy it.

But then I let go completely. The idea occurred that there are to be discovered many similarities between programming in Python (or any other object oriented language) and magic as it appears in Harry Potter’s world of witchcraft. As you all know, I have been practicing and losing a lot of time trying to create a new blog in Web2py. Web2py is a web framework written in Python, so I decided to learn the language first.

In magic you practice spells. In Python you call functions, classes, methods, objects, etc. You name them and you get some magic to happen. Just as in spell work. Sometimes, though, something turns out not to work as you expected. Most of the time because you pronounced your spell wrong (i.e. made some typographic or syntax error). More complex spells and remedies happen to be invented by some great wizards of the past. Albus Dumbledore, for example, ‘programmed’ the ten uses of dragon blood working alongside his partner Nicolas Flamel. Nicolas in turn invited the ‘philosophers stone’

Nice to discover that most of their inventions prove to be ‘open source’ solutions. Once written, they are available for the community of users. They are, as one can imagine, added to the already extensive ‘Standard Library’. Do you know, by the way, that books teaching more complex programming skills, are often called ‘cookbooks’? And that while you program, you must continually think about what ingredient you should add next? Just like in potions. Professor Snape will be delighted to hear it. Even transfiguration is a technique having an equivalent in Python. It is called ‘converting’ and it is every bit as magical. It is even possible to create restricted area’s within Python where certain logic or calls don’t work. (i.e. sandboxes). Comparable to the restrictions on certain spells within Hogwards, where nobody can disaparate as Hermione explains so many times to Harry and Ron.

I’m certainly not the only one having discovered the parallelism between Harry Potter’s world and the ways Python as a programming language functions. Even the eminent Guido Van Rossum, the founding father of Python, mentions it. Although he only discovered the similarity between his way of developing Python over the years and the writing of the saga in seven books. While plots and ingredients constantly evolved during the writing, it seems to fit all the same. As in the end everything does.

Leave a Reply

Your email address will not be published. Required fields are marked *