10.5. Python

Python is an object-oriented (OO) scripting language designed by the Dutchman Guido van Rossum in the early 1990s. It competes to some extent with Perl, which is covered in the next major section of the chapter, but has a very different philosophy than Perl. Python and Perl are both powerful languages, used in a wide variety of situations, from simple text processing to web programming, from GUI development to bioinformatics.

Whereas Perl offers many different ways to perform the same task and can be made very compact—but also unreadable to the non-expert—Python is one of the most elegant and simple languages there is, without sacrificing anything in the way of power.

The best way to convey the Python ethos is to reproduce some parts of The Zen of Python, which is a series of statements about Python written by Tim Peters:

  • Beautiful is better than ugly.

  • Explicit is better than implicit.

  • Simple is better than complex.

  • Readability counts.

  • There should be one—and preferably only one—obvious way to do it

You can read the full list at the Python website (www.python.org/doc/Humor.html#zen) or by entering the following commands in a terminal window:

Macintosh:~/Desktop sample$ python
Python 2.3.5 (#1, Mar 20 2005, 20:38:20)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import this

To summarize The Zen of Python, Python aims to make things as simple as they can be, yet still provides ...

Get Beginning Mac OS® X Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.