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 16: Line 16:
 
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.
 
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 (<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.
+
Whitespaces are 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 (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]].

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)