3 ms·
> You will never want to program without a REPL again I’m not a programmer. What does this mean in terms of Python? Does one write code in the repl then export
by bnjms 5y ago
> You will never want to program without a REPL again
I’m not a programmer. What does this mean in terms of Python? Does one write code in the repl then export it to a file to Polish when done?
- Kototama 5y agoIt's like the prisoners of Plato's cave. One could describe it to you but it's nothing like trying it. I would suggest you look for some videos or blog explaining it, or take a a week-end to try. The term REPL is here deceptive. You can load the whole compiler and the whole program in memory in a server accepting code changes and interact with them iteratively and have transparent incremental compilation when editing the code.
- azeirah 5y agoKind 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.