Skip to content

stepdown

A private helper used by one caller should be defined below that caller.

Why

Caller-first ordering keeps the module's public flow visible before its implementation details.

Fix

Move the private helper below its sole caller without changing either body.

Examples

Before — flagged Private helper appears before its sole caller
service.py
def _parse(payload: dict) -> dict:
return payload
def handle(payload: dict) -> dict:
return _parse(payload)
After — preferred Private helper appears after its sole caller
service.py
def handle(payload: dict) -> dict:
return _parse(payload)
def _parse(payload: dict) -> dict:
return payload