You are here:About>Computing & Technology>Python> Beginning Python> Python Programming - Before Programming Python - Arguments and Commands - Picking an Argument - Part 2
About.comPython
Newsletters & RSSEmail to a friendSubmit to Digg

How a Computer Reads a Program

From Al Lukaszewski,
Your Guide to Python.
FREE Newsletter. Sign Up Now!

Picking an Argument - Part 2

Now, let us move from a simple statement to a command for Jack:

Throw the ball to Jane!
Here, of course, one is telling Jack to do something, 'throw', to an object, 'the ball', with a desired recipient, 'Jane'. In programming, the computer is always the one that does things. What is to be done is, obviously, what you tell Jack, or the computer, to do. In most instances, however, if you do not tell the computer what you want it to act upon, it will not know what you mean. In this example, it will go looking for more information and find 'the ball'. However, the computer, being a bit clueless without your help, will still not know what to do. 'Throwing' carries a sense of direction with it, and the computer will want to know where you want the ball thrown. If the command was 'hold', Jack (and the computer) would know to simply sit still and hold the ball. But throwing requires direction and so one must give Jack (and the computer) an endpoint: Jane. Just like in human language, if we leave out any part of the sentence, confusion fills the gap.

These pieces of more information are what computer programmers call "arguments". Commands can require no arguments or several. Sometimes a command knows to assume information, a default setting, if other information is not given. Other times, however, the Python interpreter will look for more information, not find any, and quit without finishing the program (aka, "throw an error").

  1. Clueless Computers
  2. Reserved Words Are Key
  3. Picking an Argument - Part 1
  4. Picking an Argument - Part 2
  5. Picking an Argument - Part 3
  6. Three Statements - Part 1
  7. Three Statements - Part 2
  8. Summary

<< Previous | Next >>

 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.