353: Python
| Python |
![]() Title text: I wrote 20 short programs in Python yesterday. It was wonderful. Perl, I'm leaving you. |
[edit] Explanation
Python is a high-level programming language with a heavily simplified syntax (demonstrated here with the "Hello, world!" program).
Dynamic typing means that you do not have to declare a type for any numbers you enter (for example, "short," "float"); the Python program would automatically know how much space to assign.
Whitespace refers to all invisible text characters, like a space or a tab. In most programming languages, for example, C++, levels inside a program need to be set off by brackets while whitespace is irrelevant. By contrast, in Python you set a level simply by indenting the code.
Methods, functions and constants in Python are packed in so called modules. To use a module, you would use import MODULE. There are lots of ready-to-use modules available. The comic references this by stating that in order to fly it would suffice to import the antigravity module.
His sampling all the drugs in the medicine cabinet suggests the possibility that he's merely hallucinating flying.
Perl is another programming language. Interestingly, whereas Perl has an adage about there being more than one way to code for a solution, Python directly addresses this by insisting on only one way to code for a solution.
[edit] Trivia
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 the comic. Also, the module contains a geohashing function.
[edit] Transcript
- [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.
