Skip to content

Sample code for: Python 3.15 Preview: Sentinel Values - #823

Open
lpozo wants to merge 1 commit into
masterfrom
python315-sentinel-values
Open

Sample code for: Python 3.15 Preview: Sentinel Values#823
lpozo wants to merge 1 commit into
masterfrom
python315-sentinel-values

Conversation

@lpozo

@lpozo lpozo commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Where to put new files:

  • New files should go into a top-level subfolder, named after the article slug. For example: my-awesome-article

How to merge your changes:

  1. Make sure the CI code style tests all pass (+ run the automatic code formatter if necessary).
  2. Find an RP Team member on Slack and ask them to review & approve your PR.
  3. Once the PR has one positive ("approved") review, GitHub lets you merge the PR.
  4. 🎉

Sample code for Python 3.15 Preview: Sentinel Values, in the python315-sentinel-values/ folder.

Includes 33 Python files covering legacy sentinel patterns, Python 3.15's built-in sentinel, function signatures, type hints, copying, pickling, and loop termination. Legacy and Python 3.15 implementations use separate module names so each example runs independently. Intentional error demonstrations catch and print the expected exceptions.

Extracted from the tutorial with the post-materials skill, adapted into standalone scripts, and verified locally. All 33 files run on Python 3.15.0b3. Settings lookup/default/error behavior and the key identity and loop outputs were also checked.

The folder-local Ruff configuration inherits the repository rules and declares sentinel as a built-in because the pinned Ruff 0.14.1 predates Python 3.15. REPL imports are placed at the top of the extracted scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant