bundles / IPython 9.11.0 / IPython / core / history / HistoryManager / get_range
function
IPython.core.history:HistoryManager.get_range
source: /IPython/core/history.py:925
Signature
def get_range(self, session: int = 0, start: int = 1, stop: Optional[int] = None, raw: bool = True, output: bool = False) → Iterable[tuple[int, int, InOrInOut]]Summary
Retrieve input by session.
Parameters
session: intSession number to retrieve. The current session is 0, and negative numbers count back from current session, so -1 is previous session.
start: intFirst line to retrieve.
stop: intEnd of line range (excluded from output itself). If None, retrieve to the end of the session.
raw: boolIf True, return untranslated input
output: boolIf True, attempt to include output. This will be 'real' Python objects for the current session, or text reprs from previous sessions if db_log_output was enabled at the time. Where no output is found, None is used.
Returns
: entriesAn iterator over the desired lines. Each line is a 3-tuple, either (session, line, input) if output is False, or (session, line, (input, output)) if output is True.
Aliases
IPython.core.history.HistoryManager.get_range