Skip to content

Sync inheritance-and-composition with the updated tutorial - #929

Merged
realpython-bot merged 1 commit into
masterfrom
maintenance/inheritance-composition-python-20261029
Oct 29, 2026
Merged

realpython-bot merged 1 commit into
masterfrom
maintenance/inheritance-composition-python-20261029

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Maintenance sync for Inheritance and Composition: A Python OOP Guide.

What changed

  • composition/hr.py and choosing/hr.py: PayrollSystem.get_policy() now raises ValueError(employee_id) for an unknown employee ID instead of returning the exception instance. The tutorial's prose already says the method raises, and the update draft fixes the same line in the article's listing.

The other code-family fixes in this update (the dir() output on Python 3.13+, and the 3.12+ abstract-class TypeError wording) only touch REPL output in the article, so nothing else in this folder needed changing.

Links

Verification

  • Ran program.py in inheritance/, composition/, and choosing/, plus inheritance/disgruntled.py and choosing/rectangle_square_demo.py, on Python 3.14: all exit 0.
  • Confirmed choosing/hr.py get_policy(99) now raises ValueError.
  • uvx ruff@0.14.1 format --check inheritance-and-composition and uvx ruff@0.14.1 check inheritance-and-composition: clean.

🤖 Generated with Claude Code

…itance and Composition: A Python OOP Guide

PayrollSystem.get_policy() now raises ValueError for unknown employee IDs
instead of returning the exception instance, matching the tutorial.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@realpython-bot
realpython-bot merged commit 308e297 into master Oct 29, 2026
1 check passed
@realpython-bot
realpython-bot deleted the maintenance/inheritance-composition-python-20261029 branch October 29, 2026 07:03
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

⌂ Proxy