The Python language

Python is a programming language which is easily able to handle both the scripting tasks normally associated with Perl and the full-scale application development normally associated with C + + or Java. Using a simple, elegant, concise, syntax and a clean, consistent, semantic model, Python allows programmers to easily combine simple pieces to make a complex whole.

Throughout the rest of this book, it's assumed that you have a good working knowledge of Python, and are familiar with basic concepts such as how Python implements objects and classes. You don't need to be a Python expert to read this book, but ordinary Python language constructs are not explained in the discussion of the wxPython examples. If you need more background information on Python, the Python web site contains an excellent tutorial and other documentation at www.python.org/doc.

One important Python feature is the interactive interpreter, which can be very helpful in exploring the language and in debugging programs. If Python is installed and on your path, you can access the interpreter by entering python at a command prompt. You'll then see >>>, which is the Python command prompt. From there, you can enter any Python expression, and its value will be displayed on the screen. For example:

$ python

Python 2.3.3c1 (#50, Dec 4 2003, 21:27:34) [MSC v.1200 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.

In this short session, I did a couple of simple arithmetic functions, then used the Python built-in function zip(), to combine two lists into an associated list. You can do anything from the interpreter that you can do in a standalone Python program, including import modules, define functions, and define classes.

Was this article helpful?

0 0

Post a comment