Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search
I wrote 20 short programs in Python yesterday. It was wonderful. Perl, I'm leaving you.
Title text: I wrote 20 short programs in Python yesterday. It was wonderful. Perl, I'm leaving you.


Python is a programming language designed specifically to make it easy to write clear, readable programs. Flying is often used as a metaphor for freedom and ease, and here Randall shows Cueball literally flying in response to using Python.

A "Hello, World!" program is a very simple program that prints the phrase "Hello, World!", used in textbooks to illustrate a given programming language. While this sounds simple, it can be nontrivial in some programming languages where you need to explicitly import a library that contains the print function (for instance, in C you need to begin with #include <stdio.h>) or do complicated things with classes and variables (see the Java "Hello, World!" for one example). Python doesn't need any of that: print("Hello, world!") (or in Python 2, print "Hello, world!") really is all you need to do.

Dynamic typing and significant whitespace are two controversial features of Python, which make some people—like Cueball's friend—hesitant to use the language.

Dynamic typing means that variables do not have types (like "list of short integers" or "a bunch of letters"); any value of any type can be placed in any variable. Dynamic typing allows for more flexible languages, but it means that certain kinds of errors (like trying to subtract a letter from a number) can't be caught until a program is run, and some people think this is too dangerous for the tradeoff to be acceptable.

Whitespace is a string of invisible text characters, like spaces or tabs. In programming, blocks of code controlled by a statement are usually indented under that statement. Most languages require you to use braces ({…}) or special keywords (BEGIN…END) to delimit these blocks; in Python, the indentation itself is the delimiter. Many Python programmers find that this makes code more readable, but many other programmers find it too "magical" and don't trust it.

Classes, functions, and constants in Python are packed into modules. To use a module, you write "import module" at the top of your source file (you can do this anywhere in the file, but it's usually at the top so you can use the module throughout the code). Python comes with a very powerful standard library of modules to do everything from parsing XML to comparing two sets of files for differences, and new modules can be easily installed from the PyPI repository, which has more than 400,000 more to choose from (as of September 2022). Cueball can fly because he imported the antigravity module. Python still works for Cueball in 482: Height.

In the final panel, Cueball admits that his ability to fly may actually be because he has "sampled everything in the medicine cabinet," though he's sure it is the Python anyway. An implication of this is that ingesting everything in the medicine cabinet has given him the feeling of freedom and ease that "flying" represents - or that he is hallucinating himself flying and having a conversation with the other character about it. Here, the metaphor of "feeling like you're flying" while using Python is transformed back from being literal (Cueball is actually flying) to being metaphorical (Randall feels like he is flying because Python is so easy to use... or because he had too many strange drugs).

Perl, mentioned in the title text, is another programming language with the same target audience as Python, as both are high-level, general-purpose, interpreted, dynamic programming languages. However they strongly oppose each other in their language design:

  • Perl’s philosophy for its syntax is "There's more than one way to do it," so each coder can choose their own coding style to do exactly the same thing.
  • Python’s philosophy for its syntax is "There should be one — and preferably only one — obvious way to do it," so the written code is more consistent.

Since he has discovered Python, Randall doesn't like Perl anymore, probably because its syntax is less consistent or perhaps due to his problems with Regular expressions. What God has to say about Randall's renunciation of Perl has not yet been documented.


[A Cueball-like friend is talking to Cueball, who is floating in the sky.]
Friend: You're flying! How?
Cueball: Python!
Cueball: I learned it last night! Everything is so simple!
Cueball: Hello world is just print "Hello, World!"
Friend: I dunno... Dynamic typing? Whitespace?
Cueball: Come join us! Programming is fun again! It's a whole new world up here!
Friend: But how are you flying?
Cueball: I just typed 'import antigravity'
Friend: That's it?
Cueball: ...I also sampled everything in the medicine cabinet for comparison.
Cueball: But I think this is the python.


  • In response to this comic, the Python developers implemented the module antigravity in version 2.7+. When you import it, the default web browser will open this comic. Also, in version 3+, the module contains a geohashing function.
comment.png add a comment! ⋅ comment.png add a topic (use sparingly)! ⋅ Icons-mini-action refresh blue.gif refresh comments!


No comments yet!