Improve IDLE usability with optional ↑/↓ command history navigation

Using Python IDLE, I noticed that recalling previous commands relies on Alt + P and Alt + N. While this works, it’s not very intuitive—especially for anyone who has used Python in a terminal or tools like IPython, where the ↑ and ↓ arrow keys are the standard way to go through command history.

Many users (especially beginners) naturally try the arrow keys first and assume IDLE doesn’t support history at all when nothing happens[I just realised it support alt+p , alt+n 8 years since I had first known this language today].

I think a lot of people out here are matured with this software, language and would not see it as a valuable point, but please consider from beginners point.

The main issue seems to be that ↑ and ↓ are currently tied to cursor movement inside multi-line input, so they can’t be used for history navigation. But also the existing shortcuts aren’t very discoverable unless you already know them.

It might be helpful to modify to using ↑/↓ for command history(an optional setting to change defaults maybe).

This would make IDLE feel more consistent with how Python behaves elsewhere(like win,linux terminals), and probably reduce a bit of friction for new users, without affecting those who prefer the current system.

3 Likes

↑ and ↓ are currently tied to cursor movement inside multi-line input, so they can’t be used for history navigation

The Python shell outside IDLE handles this by having ↑/↓ switch between inputs when at the top and bottom respectively of the current input, this doesn’t seem an issue.

Could alt-arrowkeys be used to bring one to the start of the first line of the current input? This would save time when iterating upon multi-line functions in the shell (which I do often because it provides a feedback loop with the version of the function corresponding with each output being stored with it, which repeatedly running a program as a file doesn’t).

I think the reasoning behind this might be similar to the reasoning behind similar behavior in the REPL PyREPL: Add ctrl+up/down for multiline history retrieving - Ideas - Discussions on Python.org