13

I'm trying to write some python, and I'm used to the lispy way of doing things, a REPL in EMACS and the ability to send arbitrary code snippets to the REPL. I like this way of developing code, and python's built-in IDLE seems to do it pretty well. However I do like EMACS as an editor.

What's the best thing analogous to SLIME for Python?


So far:

It seems that the trick is to open a python file, and then to use 'Start Interpreter' from the Python menu, after which you get an Inferior Python buffer. You can then use C-c C-c to load the whole buffer you're editing into the 'REPL', and use normal copy and paste to put snippets into the REPL.

This works as far as it goes. Is there any way to say 'reevaluate the big thing that the cursor is in now and display the answer', or 'reevaluate the thing the cursor is just at the end of and display the answer', like M-C-x and C-x-e in SLIME?

And it all seems to work better if you use the python-mode.el from Bozhidar's answer

John Lawrence Aspden
  • 17,124
  • 11
  • 67
  • 110
  • 1
    I've also been looking for something like SLIME for Python. I've used Python interpreter in python mode but I was hoping to find something better where you can connect to a running python process and use variable name completion etc. like you do in SLIME. – user37248 Feb 26 '12 at 12:09

3 Answers3

5

There is ipython.el which you can use for some extended functionality over the vanilla python-mode. Ropemacs provides a few extra completion and refactoring related options that might help you. This is discussed here. However, I don't expect you're going to get anything close to SLIME.

Community
  • 1
  • 1
Noufal Ibrahim
  • 71,383
  • 13
  • 135
  • 169
4

I think the new python.el is a much better idea. It's under active development, it can spawn a python shell and send function definitions, buffers and files to it. It also has better than average re-indent support. It's rumoured that in Emacs 24 it might become the default python mode in Emacs.

Bozhidar Batsov
  • 55,802
  • 13
  • 100
  • 117
3

python-mode is the default mode for editing Python in emacs. It includes commands for evaluating the buffer and running an inferior interpreter instance.

nmichaels
  • 49,466
  • 12
  • 107
  • 135