Skip to content

cur / prev / nxt [terminology]

Terminology

Usage

  • Use for current, previous, and next states or linked-list nodes.
  • They are conventional in iterative pointer manipulation.
  • cur is preferred over both curr and current in compact code.
  • nxt avoids shadowing Python's next built-in.
  • Use compound forms such as cur_min when multiple current states exist.
prev = None
cur = head

while cur:
    nxt = cur.next
    cur.next = prev
    prev = cur
    cur = nxt