Hello everybody, and a question on REPL

Hello everyone.
I am a beginner in Julia, but have used Python several times in the past and am used to using REPL to develop.
I was now trying out Julia’s REPL, in the Juno editor. I realized with surprise (very like it!) That if I run the menu command Juno-> Run all
I see that the script I’m doing is re-executed in the REPL, but without losing the variables that I had already entered in the REPL.

That is, if I wrote x = 1, y = 2 in the REPL, and then I do Juno-> Run of a script where there is a sum function,
and I modify the sum function several times, every time I re-update in the REPL with Juno-> Run I don’t lose x and y at all,
as it seems to me has always happened in the Python REPL. Or at the very least, I used REPL in Python like that, that is, every time
that I was doing the “Run Module” command from Idle, the environment was totally reinitialized and then, to test my functions,
I manually rewrote the variables to be passed to the functions.

Now instead, in Juno / Julia, if I have a script with some functions, I can modify them several times and try them again in the REPL where on the fly I maybe created some
variables to test the functions, and finding them again, it seems to me a really good thing for rapid prototyping.

I hope I have explained myself well, I would like to understand this thing … is it different from what happened in Python, or maybe I used Python badly? or does Julia’s REPL work differently?

Thanks a lot for the help, I’m at the beginning with Julia, but I’m very happy with what I’ve tried so far.

Welcome! You’re right–it looks like the “Run module” IDLE command intentionally restarts the Python shell to clear all variables: https://docs.python.org/3/library/idle.html#run-module

Juno doesn’t do that, so your current variables continue to exist.

In theory, one could choose to either restart or not restart in either language, but IDLE and Juno have made different choices.

Thanks @rdeits !

I find this thing fantastic not to find the reinitialized environment every time, in the continuous modification of functions in the REPL.

Truly a great thing …
maybe, as you say, there will also be some option in the Python IDLE, but frankly, being so used in Python, I never thought that a REPL where the already instantiated variables do not disappear, is even better …

I see on internet this questions, it seems not so simple to do the same thing in IDLE of Python … mmmh … perhaps it is a radical choice … some say … well it’s better to restart to be sure to have a clean ambient to test yout program … but i think in many situations, the Juno/Julia way is better, the rapid prototiping it much more rapid in this way!