MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / get_or_default

Function get_or_default

example_code/item_124_example_10.py:22–25  ·  view source on GitHub ↗
(value: int | None, default: int)

Source from the content-addressed store, hash-verified

20# Check types in this file with: python3 -m mypy <path>
21
22def get_or_default(value: int | None, default: int) -> int:
23 if value is not None:
24 return value
25 return value # Oops: should have returned "default"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected