1. Home
  2. Computing & Technology
  3. Python

How a Computer Reads a Program

From Al Lukaszewski, for About.com

4 of 8

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").

Explore Python
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Python
  4. Beginning Python
  5. Python Programming - Before Programming Python - Arguments and Commands - Picking an Argument - Part 2

©2009 About.com, a part of The New York Times Company.

All rights reserved.