5 ms·
Unfortunately, PyCharm does not (by default) encourage the wonderfully productive development pattern of ``python -i`` -- running the script and breaking into t
by xapata 10y ago
Unfortunately, PyCharm does not (by default) encourage the wonderfully productive development pattern of ``python -i`` -- running the script and breaking into the interactive prompt afterwards. IDLE does this and it's excellent for teaching. Any other technique and the students are much less likely to develop the habit of testing/debugging code interactively in the REPL.
Even if you do invoke the interactive mode in PyCharm, each execution creates a separate prompt, causing confusion. I'll admit I'm not the most skilled PyCharm-user. Perhaps there's a way to make it work like IDLE?
- globalgoat 10y agoI think I tend to agree here. I've taught a few terms of the Python courses through @codeclub to primary school children in the UK (aged 10-11) using IDLE and it works well. It's also worth considering that IDLE is a relatively lightweight install and on the network at the school that I teach at, everything is extremely locked down and installing anything causes an amount of pain. That said I think I'll still investigate.....
- petra 10y agoAFAIK, PyCharm doesn't have good auto-completion in the REPL, right ? Any decent alternative ?
- deleted 10y ago[deleted]
- pauleveritt 10y agoIf you install iPython into your project interpreter, it will be used.
- Foivos 10y agoOr even better ipython / Jupyter notebook
- gmu3 10y agoThis is a bit different but in PyCharm you can set a breakpoint and then in the debugger open up a window where you can evaluate arbitrary expressions with that context before continuing.
- xapata 10y agoI like to introduce debuggers/breakpoints after teaching functions and classes. That way I can explain the purpose of a debugger as bringing back the interactivity of the REPL despite hiding variables in local scopes.
- pauleveritt 10y agoThe run configurations let you check a box that drops you into the interpreter console afterwards. If you install iPython, it will be used. Is that describing what you're looking for?
- xapata 10y agoNot quite. If you re-run the script it creates a new console rather than restarting in the current. That leads to an awkward proliferation of consoles with no keyboard shortcut to close them. I encourage my students to run code very frequently. I'm hoping I simply overlooked something.
- keithoffer 10y agoYou can tell PyCharm to only run a single instance of python by going to Run -> Edit Configurations -> Tick 'Single Instance Only' in the top right.
- xapata 10y agoAh! Thanks much.
- bsg75 10y ago> the wonderfully productive development pattern of ``python -i`` -- running the script and breaking into the interactive prompt afterwards TIL
- deleted 10y ago[deleted]