GII

Appendix B

Editors for Python


There are many fine editors available on the internet; these are just a few.

VI and VIM

The vi (pronounced "vee-aye") editor is the classic UNIX editor, which has been ported to many other platforms, including Windows.  Originally written for Berkeley UNIX by Bill Joy (now head of Sun Microsystems), the basic command set has remained unchanged for two decades; it has been extended and improved, but all the commands, tricks and shortcuts that I learned in the early 80s still work, and work well, on all the platforms I work on.

The vim editor ("vi improved") is the best extended version of vi available.  This version has a vastly extended command set, can do syntax coloring, and even has a special Python mode to ensure correct indentation and coloring.  Here's a screenshot of vim, with my personal preferences enabled, editing a Python program:

vim editing a Python program
Figure B.1:  vim Editing a Python Program

You can find out everything you need to know about downloading, installing, running and customizing vim at  http://www.vim.org/; vim is freeware.

EMACS

Emacs is undoubtedly the most customizable editor for anything that has ever existed.  Here's a short quote from the online FAQ on emacs, regarding the history of the program:

"Emacs originally was an acronym for Editor MACroS.  RMS [Richard M. Stallman, founder of the Free Software Foundation] says he 'picked the name Emacs because `E' was not in use as an abbreviation on ITS at the time.'  The first Emacs was a set of macros written in 1976 at MIT by RMS for the editor TECO (Text Editor and COrrector, originally Tape Editor and COrrector) under ITS on a PDP-10.  RMS had already extended TECO with a 'real-time' full screen mode with reprogrammable keys. Emacs was started by Guy Steele as a project to unify the many divergent TECO command sets and key bindings at MIT, and completed by RMS."

In the popular mythology, however, emacs has come to stand for "escape-meta-alt-control-shift," referring to the complex key combinations to perform frequent commands shipped as the default.  I like emacs, and once spent six weeks learning emacs Lisp (the dialect of Lisp created specifically for the construction of emacs) and customizing emacs expressly to suit my style of work.  I actually prefer it to vi, but now that I must work on Windows machines as well as UNIX/Linux ones, I find that in order to use my custom keybindings I need to invest substantial sums in keyboards, and it's just easier, and quite portable, to use vi.

Just to give you a view of what the default version looks like, though, here's the version I occasionally run on my Windows machines:

Emacs editing a Python program
Figure B.2:  emacs Editing a Python Program

emacs, too, is also (naturally) freeware.  The best place to go for information on all aspects of emacs care, feeding and mythology is http://www.gnu.org/software/emacs/.

XEMACS

This editor, xemacs, which is also freeware, is based on emacs, initially on version 19 from the FSF.  It purports to be "EMACS:  The Next Generation."  I don't run this myself, so there are no screenshots, but many on the Python Mailing List speak highly of it.  The best place to go for downloading information, and more, is the home page at http://www.xemacs.org/.

ALPHA

Alpha is a shareware editor for the Macintosh; the shareware fee is quite reasonable, however, and again, many people speak very highly of it on the Python Mailing List.  Go to http://alpha.olm.net/ for the usual information.  I don't have a Mac, so no screenshots.

IDLE

IDLE comes with your Python distribution, but it may not be pre-installed for you on many Linux distributions; even on the Red Hat distribution, which uses Python extensively in its configuration programs, IDLE is not by default installed.  The reason for this, of course, is that IDLE only began to be available beginning with Python 1.5.2, and Red Hat distributes 1.5.1 (certainly a stable version, and all the examples and code in this book should work without change).

I feel that IDLE is worth the trouble of installing it, but many may not feel that way; on certain Linux distributions it is very difficult to get running.  On Red Hat, you can build Python yourself, but in order not to break the Red Hat scripts you need to install it into /usr/bin instead of the default /usr/local/bin; this is easily accomplished by specifying "./configure --prefix /usr/bin" when you run the configure script before compiling Python.  If you have no idea what I'm talking about, it's probably best if you leave the Red Hat Python 1.5.1 installed version in place.

The Windows installer for Python 1.5.2 gives you everything Python, plus IDLE, except that it doesn't make a desktop shortcut for IDLE; refer to Hour 2 for instructions on how to make one yourself.  While you've seen lots of screenshots of IDLE in action in this book, here's a screenshot of IDLE's editor window, editing the same Python program shown above in the other editors:

IDLE editing a Python program
Figure B.3:  IDLE Editing a Python Program

The usual place for Python information, including IDLE, is http://www.python.org/

There is also an extremely nice tutorial on IDLE, written by Daryl Harms, available at: http://www.python.org/doc/howto/idle/. It combines color pictures with detailed explanations.


Valid HTML 4.01 Transitional