Editors
At the minimum you need a general-purpose text editor to create/modify a textfile (say "helloWorld.py") and a command line shell (terminal) in which to run the python interpreter with your script as argument (here: python helloWorld.py). Shells typically have command line recall (arrow up, arrow down) and file name completion (Tab key) to cut down on typing. (More on the python interpreter here)
Python IDEs (Integrated Development Environment)
IDEs offer more specific functionality for programmers than text editors and allows to to run python scripts "inside" (usually including an interactive python shell version). The standard IDE for python is called Idle. See Chapter 3 in the textbook (How you run programs) or here. Although it's somewhat basic, it's usually installed as part of the Python on Windows, Mac and Linux.Check out the Configuration options and keyboard shortcuts (also under Edit). A couple of notes:
- Windows
- Mac (more on Python on the Mac)
- textedit.app (make sure to initially save the program as plain text, cmd-shift-t)
- TextWrangler (freeware, looks nice, has python syntax coloring, haven't used it myself yet)
- Shell/terminal: terminal.app (/Applications/Utilities folder or spotlight it)
Python IDEs (Integrated Development Environment)
IDEs offer more specific functionality for programmers than text editors and allows to to run python scripts "inside" (usually including an interactive python shell version). The standard IDE for python is called Idle. See Chapter 3 in the textbook (How you run programs) or here. Although it's somewhat basic, it's usually installed as part of the Python on Windows, Mac and Linux.Check out the Configuration options and keyboard shortcuts (also under Edit). A couple of notes:
- Interactive Python shell
- Previous/next line in your command "history": Alt-p / Alt-n on Windows (Mac: Control instead of Alt), rolls over
- I usually just roll backwards (or forwards) one line at a time but if type a couple of letters first and then press Alt-p/Alt-n and you will only get commands starting with these letters. So if you earlier evaluated three lines starting with print, typing pri and hitting Alt-p will bring back each of these earlier lines
- More on completions:
- Alt-/ (slash) will expand keywords, including user defined functions (same file or shell)
- Control-Spacebar
will let you chose from a list, up/down arrow to move, Return to select - File - New opens a new file editor, you need to manually append .py when saving a file
- Formatting code (Editor):
- Indent/Un-indent mouse selected lines with Control-[ and Control-] (Mac)
- Comment/Un-comment: Alt-3 / Alt-4
- Run script in Editor: Hit F5 (edit window has to be active not the shell, you can turn off Save reminder with Windows-Configuration-General-No Prompt)
- Got errors? To jump to the error's line: right-click on the Trackback block - Goto file/line
- (Something I'd like to know myself: Running a script with arguments from within Idle)
- Downside: visual debugger is clunky, have not tried the pdb command line debugger
- PythonWin (pywin32) is another pretty basic (Windows only) Python IDE that includes minimal GUI debugger.
- Wing IDE 101: free, basic edition of the Wing commercial Python IDE, Windows, Mac (via X11) and Linux. For me it offers just enough functionality (especially the debugger) without getting too confusing :) Version 4 just came out. Download here or scroll down to Wing IDE 101 on the downloads page
- pyscripter : open source, Windows only (?)
Links to other IDE's submitted by students (as I didn't originally enable comments and apparently can't turn them on for older posts:
Aptana (http://www.aptana.org/studio) - submitted by Jason (seems to be mostly a web dev thing?)