{ } Raw JSON

bundles / IPython 9.13.0 / IPython / core / history / extract_hist_ranges

function

IPython.core.history:extract_hist_ranges

source: /IPython/core/history.py :1202

Signature

def   extract_hist_ranges ( ranges_str : str )  →  Iterable[tuple[int, int, Optional[int]]]

Summary

Turn a string of history ranges into 3-tuples of (session, start, stop).

Extended Summary

Empty string results in a [(0, 1, None)], i.e. "everything from current session".

Examples

list(extract_hist_ranges("~8/5-~7/4 2"))
list(extract_hist_ranges("~4/"))
list(extract_hist_ranges("4-"))
list(extract_hist_ranges("~4/4-"))
[(-4, 4, None)]

Aliases

  • IPython.core.history.extract_hist_ranges