4 ms·
Kind of, a Python REPL is nothing more than a live Python environment. You type some Python code and you immediately see the result. The main idea behind a REPL
by azeirah 5y ago
Kind of, a Python REPL is nothing more than a live Python environment. You type some Python code and you immediately see the result. The main idea behind a REPL is to speed up the feedback loop of write code -> execute code -> verify results -> modify code -> repeat.
The simplest REPL you're probably familiar with is a separate window where you can execute some Python code which you can then copy paste into your editor where you can polish it. This is helpful, but a REPL (even the Python REPL) can do more.
For example a nice IDE for python or lisp lets you execute selected pieces of code with a single keypress. You immediately know whether it works, and you can try out your snippet with different inputs to quickly test it etc.
You'll often make a modification or two after checking your code in a REPL, and good IDEs will let you replace the original snippet with your modified snippet with one or two key presses.
REPLs tend to be a little bit nicer if they're well integrated into your program, for instance you can load parts of your program, or start a REPL with a breakpoint in the middle of a program to debug your code from within a REPL. Again, intelligent IDE integration makes this really cool!
In the case of many Lisps, REPLs have even deeper functionality. You get features like automatically being thrown into a REPL when an error happens, so you can rewrite the code and pretend the error never happened and run it with the updated version. This is even possible in live code! (I believe some lisp code running in a space device at some point was updated from within a REPL in this way? While it was in space!)
I believe there is even more to it than that, but I've never gone deeper than this.
- mark_l_watson 5y agoThe old Python support for Emacs was such very good support for true REPL driven development. I have been using Lisp languages professionally since 1982, so I am fussy about having good REPL support. I usually use PyCharm Pro and VSCode when I have to use Python for work gigs (I do deep learning about 100% of the time now), but when I want a great REPL experience I flip over to Emacs.