Created
April 20, 2023 15:52
-
-
Save nihaals/87950f75cda7bb2123a2509cb2c79225 to your computer and use it in GitHub Desktop.
Python shell temporary history
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disables Python's default history handling | |
# See https://github.com/python/cpython/blob/4898415df724380d4c8b0ec08e8cb92f126193c3/Lib/site.py#L462-L483 | |
# Makes history only available in the current shell and stops reading and writing it to disk | |
# Only side-effect is there is an empty history entry before getting a bell while pressing up arrow | |
__import__('readline').add_history('') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment