Parent issue: #1673
Goal
Apply consistent error handling, early-exit patterns, and output messages across all examples.
Current state
Error handling:
- Some files use
sys.exit(0) for unsupported configurations; others silently skip.
- NumPy version checking uses two different APIs (
np.__version__ < "2.1.0" vs np.lib.NumpyVersion()).
- Validation is a mix of
assert statements and print + sys.exit.
Output messages:
- Completion messages vary:
"done!", "done" (no exclamation), "Example completed successfully!", "All tests passed successfully!", "Memory management example completed!", or no message at all.
- Some examples print intermediate progress, others are silent until the end.
- Some use
sys.stderr for warnings/info, others use stdout.
Decisions needed
- What is the standard early-exit pattern for unsupported configurations?
- Should examples use
assert or print + sys.exit for validation?
- What should the standard success message be (or should there be one)?
- Should warnings/skip messages go to stderr or stdout?
Files affected
All 25 example files listed in #1673.
Parent issue: #1673
Goal
Apply consistent error handling, early-exit patterns, and output messages across all examples.
Current state
Error handling:
sys.exit(0)for unsupported configurations; others silently skip.np.__version__ < "2.1.0"vsnp.lib.NumpyVersion()).assertstatements andprint+sys.exit.Output messages:
"done!","done"(no exclamation),"Example completed successfully!","All tests passed successfully!","Memory management example completed!", or no message at all.sys.stderrfor warnings/info, others usestdout.Decisions needed
assertorprint+sys.exitfor validation?Files affected
All 25 example files listed in #1673.