# https://docs.python.org/3.15/library/readline.html
import atexit
import os
import sys
import rlcompleter
import readline

readline.parse_and_bind('tab: complete')

# try:
#     import readline
#     import rlcompleter
# except ImportError:
#     print >>sys.stderr, 'readline/rlcompleter module not available'
# else:
#     readline.parse_and_bind('tab: complete')

# disable ~/.python_history
# del sys.__interactivehook__

histfile = os.path.join(os.environ["XDG_STATE_HOME"], "python_history")
try:
    readline.read_history_file(histfile)
except FileNotFoundError:
    pass

atexit.register(readline.write_history_file, histfile)

