I often use ipython(or a regular python shell) to check for snippets of python code during coding, and this was very useful. One of the drawbacks of this, however, is that if I want to test a multi-line code segment or want to write several lines of code before running, it is not very convenient to do it “line by line”. And even returning to changing some lines is cumbersome because you need to re-enter all the code that appears after it.
Now I play with Groovy, and I believe that he has an excellent solution to this problem: Groovy Console , you just write all the code you want, it's just like a regular editor; and then you press Ctrl + R (Cmd + R actually, since I'm on a Mac) and it launches all at once. If you want to change something (for example, if there are errors), then this is also easy - just change it and Ctrl + R again.
Is there an equivalent to this for python? Or do you have any recommendations for achieving similar behavior? I could just create a new file, save it, and then python <filename>.pyfrom the shell. But it is too many steps and will be bulky. Eclipse may be an option, but it is too heavy. I am really looking for something easy that I can just spin up when I want to check something and then get rid of it just as quickly.
I would be interested to hear any ideas / suggestions!
thank
source
share