Here’s my attempt at edit and continue for Python. (It would also work inside a function.)
Here’s another one I’m aware of (I haven’t found the source for it).
How does this compare with Mathematica, Maple, and other interactive notebook programs? It reminds me very much of using Maple 15+ years ago.
This is also very much how I use the REPL in Common Lisp environments, albeit a little differently. You have access to previous computations and values with the symbols *, **, ***, and +, ++, +++ so you can manipulate access recent history and try things again.