Hacker News new | ask | show | jobs
by sfsys 1989 days ago
I've been doing exactly this for a while now using Emacs built-in python mode and I think it's its quite nice. With just a few keystrokes I can send any part of the code I'm working on into a running python process and see the results in a separate repl buffer. The built-in python-mode already has a good selection of possible selections to send and I've written two extra ones working with indent levels dependent on where the cursor currently is. [1] It's nice to be able to, for example, run the if statement you're currently writing without running the while loop that if statement is in.

One important thing to keep in mind though is that it is not as dynamic as Lisp, so things like re-evaluating a class definition does not update existing objects. I end up restarting the python process and evaluating the buffers I'm working on often enough that I've bound it to its own key.

[1] https://pastebin.com/ctz5erD4

1 comments

Thanks for the definitions =)...

I've not used emacs for python, but could give it a spin for this!

Bit unfortunate that you need to restart the process for re-evaluating classes though.

Yeah. There are a quite few niggles like that. Even though you can get quite close by (automatically) sending code to the repl, Python is simply not set up for interactive development.

It's one of the main reasons why I love Common Lisp so much.

Still, it's not too bad and IMO a lot better then restarting the process on every single change