Skip to content

Return path highlighting

Return path highlighting marks explicit return statements in a Python function when the caret is on that function's return annotation.

How to use it

Place the caret inside the return annotation expression of an annotated Python function.

def build_user() -> User:
    if cached:
        return cached_user
    return User()

With the caret on User, BetterPy highlights the return statements in build_user.

Notes

  • The feature highlights explicit return statements only.
  • Returns inside nested functions or classes are treated as separate scopes.
  • The feature is gated by the Return path highlighting setting under Settings | BetterPy | Navigation discovery | Navigation.