[Python-Dev] oh, and any interest in my readline history stuff?

Skip Montanaro skip@mojam.com (Skip Montanaro)
Wed, 5 Jul 2000 20:16:05 -0500 (CDT)


    Greg> I'm against additional magic environment variables.

    Greg> Can't you just have people put something into their .pythonrc
    Greg> file? Or will it still require some C-level changes?

C-level changes are still required, but just to expose the existing
functions in the GNU history library.  After responding to Fred's note, I
realized that what I'm doing in rlcompleter.py:

    import os
    histfile = os.getenv("PYTHONHISTORY")
    if histfile is not None:
	try:
	    readline.read_history_file(histfile)
	except IOError:
	    pass
	import atexit
	atexit.register(readline.write_history_file, histfile)
    del os, histfile

could just as easily be done in ~/.pythonrc.  Maybe I should retract the
rlcompleter mods and just give something like

    import os
    histfile = os.path.join(os.environ["HOME"], ".python_history")
    try:
        readline.read_history_file(histfile)
    except IOError:
	pass
    import atexit
    atexit.register(readline.write_history_file, histfile)
    del os, histfile

as an example in a yet-to-be-written libreadline.tex.

Skip