The Python Editor

The PythonWin editor has many features especially designed for Python programs. In many cases these features are shared between IDLE and PythonWin; both IDEs use exactly the same (Python!) code to implement the same features.[1] The most important features with a brief description are provided here:

Unlimited undo and redo capabilities

Enough said!

Smart indentation

The editor examines existing source files to determine their indentation. If configured, the editor can override your tab preferences to match the existing file. When indenting an incomplete expression (such as a multiline list definition or function call), the correct indentation is applied to line up elements in the list or the call parameters. Entire blocks can be indented or not to allow easy program restructuring.

Block commenting

You can select a block of text and have it all commented or not with a single command.

Comment and multiline string formatting

Comment blocks and multiline strings can be reformatted. This command correctly reformats paragraphs to a 70-character width.

Attribute expansion

If you type the name of a module and certain other objects, then press the period key, a list box is displayed with a selection of attributes. The arrow keys allow you to change the selection, and the Tab key selects it. You can see this by typing string. in an editor or interactive window. As this book goes to press, this feature had not yet been ported to IDLE.

Call tips

As you type the name of a Python ...

Get Python Programming On Win32 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.