The Python Editor
You can use IDLE as an ordinary text editor to write Python programs. As discussed previously in this chapter, PythonWin recently adopted many of IDLE’s best editor features, so the same, rich, Python-aware editing environment is available in IDLE. It’s worth noting that IDLE and PythonWin have different default keyboard bindings, so the same features may be accessed in different ways; check the IDLE menus for the shortcut keys.
IDLE also colors the text of your program according to syntactic categories. For example, strings are displayed in green, so when you forget a string quote, you will probably notice before you run the program. Other editors have this feature, and some support Python’s syntax, but not many (not even Emacs) get it right at all times. The inaccuracy can be annoying, especially when you are editing multiline string literals. IDLE boasts that it gets the coloring 100% right, but you wouldn’t expect any less from a Python source-code editor written in Python!
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access