How to setup a complete IDE using python-mode.el was shown at EuroPython-2013 at Florence: resp.

Get the latest release from:

The relevant page also has installation instructions. The following was enough for me, though:

 (autoload 'python-mode "python-mode" "Python Mode." t)
 (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
 (add-to-list 'interpreter-mode-alist '("python" . python-mode))

this could be useful: (RichardRiley : why?)

Many distros add relevant autoloads e.g. Gentoo adds it to site-lisp/site-gentoo.el or possibly site-lisp/site-gentoo.d


python-mode.el reduces number of needed keystrokes providing tailored commands. It makes edits faster, assists programming by speech, macro-driven input etc.

Support Python language features, for example:

py-up, py-down - travelling nested blocks

Avoid typos fetching forms at point, a clause for example:




No need to customize when testing different versions:




- Notion of finer grained parts - py-expression, py-minor-expression

- Commands running versioned and paralleled (I)Python-executables, no need to re-define the default Python largely removing the need of an active region marked before, see py-execute-line and a whole bunch more

Have a look at the menu. Directory “doc” lists commands.

some more commands

 (defun py-next-block ()
   "go to the next block.  Cf. `forward-sexp' for lisp-mode"
   (py-mark-block nil 't)

ElDoc works with the python mode in GNU Emacs 22. (For Emacs 21, see the back-port of Eldoc.) To enable it by default in your python mode buffers, you might want something like:

   (add-hook 'python-mode-hook
          '(lambda () (eldoc-mode 1)) t)

‘py-help-at-point’ can be used to get the internal python documentation on the function at point.

For Emacs 23: C-c C-f “sys” – this works, and describes the “sys” module in a separate Emacs help buffer.

If I define function “zoot”, help doesn’t on it – it’s only for global things.

(Andreas Röhler: No: inside current buffer it jumps to definition, no need for a help buffer.)

Integrating python-mode's pdbtrack with xpdb and making it aware of generator expressions


I have found the following settings helpful in using xpdb:

;; Let python-mode know about xpdb and generator expressions.
(setq py-pdbtrack-input-prompt "\n[(&amp class="comment">;amp;amp;lt;]*x?pdb[>)]+ "
      (concat "^&amp class="comment">;amp;amp;gt; \\(.*\\)(\\([0-9]+\\))"
	      "\\([?a-zA-Z0-9_]+\\|&amp class="comment">;amp;amp;lt;genexpr>\\)()"))

xpdb is a fork of the standard library pdb, available here:

other things you may be interested in