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

Guido van Rossum guido@beopen.com
Thu, 06 Jul 2000 02:00:49 -0500


> 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.

Yes, much better.

--Guido van Rossum (home page: http://dinsdale.python.org/~guido/)