I want to add a function like this:
def history():
import readline
for i in range(readline.get_current_history_length()):
print (readline.get_history_item(i + 1))
so that whenever I'm in a Python shell (like running python3
) or if I hit a breakpoint using ipdb in Python code, that I can just call history()
.
Where do I add this code? (MacOS)