Skip to content

Instantly share code, notes, and snippets.

@nihaals
Created April 20, 2023 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nihaals/87950f75cda7bb2123a2509cb2c79225 to your computer and use it in GitHub Desktop.
Save nihaals/87950f75cda7bb2123a2509cb2c79225 to your computer and use it in GitHub Desktop.
Python shell temporary history
# 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