Editing 353: Python

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 18: Line 18:
 
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 (<code>{…}</code>) or special keywords (<code>BEGIN…END</code>) 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.
 
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 (<code>{…}</code>) or special keywords (<code>BEGIN…END</code>) 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 "<code>import ''module''</code>" 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 <code>antigravity</code> module. Python still works for Cueball in [[482: Height]].
+
Classes, functions, and constants in Python are packed into modules. To use a module, you write "<code>import ''module''</code>" at the top of your source file. 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 79,000 more to choose from (as of April 2016). [[Cueball]] can fly because he imported the <code>antigravity</code> 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).
 
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).
Line 24: Line 24:
 
{{w|Perl}}, mentioned in the title text, is another programming language with the same target audience as Python, as both are {{w|High-level programming language|high-level}}, {{w|General-purpose programming language|general-purpose}}, {{w|Interpreter (computing)|interpreted}}, {{w|dynamic programming language}}s.
 
{{w|Perl}}, mentioned in the title text, is another programming language with the same target audience as Python, as both are {{w|High-level programming language|high-level}}, {{w|General-purpose programming language|general-purpose}}, {{w|Interpreter (computing)|interpreted}}, {{w|dynamic programming language}}s.
 
However they strongly oppose each other in their language design:
 
However they strongly oppose each other in their language design:
* Perl’s philosophy for its syntax is "{{w|There's more than one way to do it}}," so each coder can choose their own coding style to do exactly the same thing.
+
* Perl’s philosophy for its syntax is "{{w|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 {{w|Zen of Python|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.
+
* Python’s {{w|Zen of Python|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 [[1171|Regular expressions]].  What [[224|God]] has to say about Randall's renunciation of Perl has not yet been documented.
+
Since he has discovered Python, [[Randall]] doesn't like Perl anymore, probably because its syntax is less consistent.
  
 
==Transcript==
 
==Transcript==
:[A Cueball-like friend is talking to Cueball, who is floating in the sky.]
+
:[A friend is talking to Cueball, who is floating in the sky.]
 
:Friend: You're flying! How?
 
:Friend: You're flying! How?
 
:Cueball: Python!
 
:Cueball: Python!
Line 47: Line 47:
 
[[Category:Comics featuring Cueball]]
 
[[Category:Comics featuring Cueball]]
 
[[Category:Programming]]
 
[[Category:Programming]]
[[Category:Comics with lowercase text]]
 

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)