Emacs is an excellent programming environment for Python. I've selected a handful of packages here that together give a very neat coding experience. There are many alternatives for just about every package on display here, but these are my current favourites when coding Python.
Auto completion, syntax checking and method help
In just this wee picture you see several great Emacs features at play: auto completion by anaconda-mode and autocomplete-mode, on the fly syntax checking using pyflakes and flymake, as well as intelligent method help in the minibuffer thanks to eldoc and anaconda-mode:
Auto completion with documentation lookup
If you just hold on for a bit longer, Emacs will also give you the full documentation of the method which you are about to complete:
Documentation lookup
anaconda-mode will also look up any documentation for you on any
symbol when you hit M-?
:
Code navigation
anaconda-mode hooks into Emacs' standard tagging feature, which means
you use the standard shortcut M-.
for jumping to the definition of
the symbol under your cursor and M-*
for jumping back to where you
were. It's really, really fast and let's you drill down or up your call
stacks with amazing speed.
Show usage of symbol at point
Hitting M-r
will show you all the usages in your project of the
symbol at point:
Embedded Python shell
Naturally, Emacs gives you a Pythons hell inside Emacs so that you
easily can try out code before adding it to your own source code. Just
type M-x python-shell-switch-to-shell
and the Python interpreter
opens up in a new buffer:
sys.exit(0)
And that concludes my wee tour through some of Emacs' Python features. Happy coding!
Useful links
- My Python and projectile & ido setup in Emacs
- anaconda-mode
- autocomplete-mode
- pyflakes
- flymake,
- eldoc