Skip to content

2 different history filenames, which is right?- Probably neither #4

@eabase

Description

@eabase

There are actually 3 different filenames for the python history history_filename circling around.

In vanilla Python 3.10, without pyreadlineX, the python history is hard-coded to: ~/.python_history. (Unfortunately!)
See PR discussions here and here. (Clearly even the cpython dev's have no idea where this is going!) 🤣


However, here in pyreadlineX, we have 2 different ones.

  1. In ./lineeditor/history:
class LineHistory(object):
	    def __init__(self):
	        self.history = []
	        self._history_length = 100
	        self._history_cursor = 0
	        # Cannot expand unicode strings correctly on python2.4
	        self.history_filename = os.path.expanduser(ensure_str('~/.history'))
	        self.lastcommand = None
	        self.query = ""
	        self.last_search_for = ""
  1. In ./configuration/pyreadlineconfig.ini:

history_filename("~/.pythonhistory")

  1. (and again used in various places in) ./rlmain.py:
        def sethistoryfilename(filename):
	            self.mode._history.history_filename = os.path.expanduser(
	                ensure_str(filename))

Neither of these should be used, AFAICT, unless the purpose is different from what should be obvious.

The only thing, I would hate, is if that it would overwrite (or interfere with) the already built-in history.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions