Please note: This wiki is currently running in test mode after an attack on January 5 2013. All passwords were reset, so you will have to use the password recovery function to get a new password. To edit wiki pages, please log in first. See the wiki attack description page for more details. If you find problems, please report them to the pydotorg-www mailing list.

Python's syntax requires special handling in the construction of a Python editor mode. Two issues are particular to Python:

See also HowToEditPythonCode for concrete examples of editor configuration.

Indentation

Python uses indentation to group statements. A well designed mode should offer support for smart indentation of code. For example, a line beginning with the keyword def and ending with : should cause the editor to indent the following line upon hitting of the return key.

The most widely used standard is four-space indent. Using tabs is discouraged, so the editor should be configured to convert tabs to spaces.

Code examples or references on how to deal with indentation should follow.

Strings

Python supports three types of string literals. Strings can be enclosed in single quotes ('), double quotes (") and in groups of three single or double quotes (and are then referred to as triple-quoted strings). A well designed mode should support all three types. In particular, a mode should correctly recognize that triple-quoted strings can include unescaped newlines and quotes.

Python allows for raw strings without \-escape sequences (written with a preceding r: r"c:\dir1\dir2"). A well designed mode should support this feature as well.


CategoryEditors

EditorConfigurationHowto (last edited 2010-05-20 23:29:02 by 65)