# Programming is the closest thing to magic

It's true. If you want to practice magic, but know there's no empirical evidence for such things, start programming. To illustrate this more, let's think about what magic is, and what it requires. Magic is simply a control over natural forces. It often involves precise instructions (through means of spells or potions), and a deep understanding of the world the magic influences and the magic itself.

This is directly akin to programming. If you brought a computer back in time (you wouldn't have to go far) you would probably be accused of witchcraft and burned. Computers can be made to do anything very fast and very accurately, and eventually with greater intelligence than humans. (Though that's a subject for another post.) Anything magic can do, a programmer can simulate it with the computer, and in many cases could get some hardware together and accomplish the same thing. Flying? Science did that, but ever since computers came on the scene Science has been using them to perfect its models and creations. Flying today is much more powerful than it was with the Wright Brothers. I hope it's not too much of a stretch to see why programming, just as magic, exerts a control over natural forces. Leave me a note though if you disagree.

Now to address what kinds of magic you get. When you program, you are giving precise instructions to a computer. Depending on the programming language you use, you might have to explicit more or less instructions. This is similar in magic: the types where you simply say a single word aren't usually so powerful (at least by themselves; that is, uncontrolled), whereas the most powerful types of magic usually involve multiple practitioners, each with great control, and a complicated series of rituals, sacrifices, and so forth. It is important to note, however, that the higher single-word magic can be greatly increased in power when some intention is added, and the user has more control over it. I don't really want to bring up Harry Potter, but it's widely known and has an example of this. Harry tries to use Crucio without entirely meaning it, as if the magic just resided in the word or the wand.

Now compare two programming languages. Python is of the high-language single-word typed variety, and C is the low-level one that takes lots of time yet can produce very powerful results, and some of the largest group projects (e.g. the Linux kernel) are done in C. You can get even lower than C with Assembly, where one wrong instruction used to be able to tell your hard drive to destroy itself, but we don't need to for this discussion.

Now here's an argument for why to use a high-level programming language. Sure, you get more power with C, but it takes a long time to get anything of significance accomplished. With Python, you can very easily write a program to do Calculus for you, when the same program in C would take not only more time, but also a deeper understanding of the language instead of the problem. (In this case, doing Calculus.) C's problem is that it requires a lot of understanding of the magic itself, long before you can do anything useful with the outside world the magic affects. Thus in order to do Calculus, you must understand C at a deep level and you must understand Calculus at the level you wish C to perform it. To do Calculus in Python, you need to understand Python at a relatively basic level before you can do Calculus. In a certain programming book with Scheme (another high language) it starts you off doing Calculus. Try finding a C book that does that!

So when most people think they want to do magic, they mean the type which the magic itself is fairly simple to understand. In Harry Potter world, the word(s), the wand, and the intention are the three important things, but above all the intention. Magic can be done without the other two in that world; those exist purely for added control and safety. Because of this, I think Python would be an excellent candidate for the budding magician of the computer. It's pretty easy to learn, yet is extremely powerful, and a master can actually use it in conjunction with C and get extra power that way. But mainly, Python lets you focus on the problem at hand--what you are going to do with your magic, instead of the magic itself. What use is knowing Wingardium Leviosa when you can't see to put it to good use taking down a Troll? Now imagine if that spell were very complicated and the students had only had one exposure to its use: would they think to use it in other situations so readily?

I've primarily used Python for shell scripting tasks including math, cracking, adding up bowling scores, and many others I'm likely forgetting. I've also used it for video games, and I've tinkered with it in web applications and full blown desktop apps with Tkinter. But where I don't use Python, I almost always use another high level language in its place. I know C fairly well, but really I just want to sit down and use magic, instead of learning about it. And because Python lets me use my magic, I am armed against all sorts of challenges without having to study the magic itself at all. Going back to the Calculus thing in C: I could probably do it with the knowledge I have now, but I'd likely need to look up a few things, and then realize "Oh, I learned about that, it's neat I can apply it here."

Finishing up, want to do magic? First learn one of the magics, with my suggestion being Python, and then use it. The computer is your own magical world, but, unlike the magic of fantasy worlds, with the right hardware and understanding of the problem you can extend into the Real World. We are at the start of the age that will end with absolute control over the universe, and computers are the means to do so. Intelligence is much more powerful than evolution, which is much more powerful than simple emergence, the optimizer that created the stars and the planets and the situations that first gave life. Computers and programming are here directly because of human intelligence; let's use them to do whatever, especially magic.

#### Posted on 2009-06-12 by Jach

Tags: programming, python

LaTeX allowed in comments, use $\\...\\$\$ to wrap inline and $$...$$ to wrap blocks.