Skip to content

Sync instance-class-static-methods with the updated tutorial - #837

Merged
martin-martin merged 2 commits into
masterfrom
maintenance/instance-class-static-methods-20260916
Sep 23, 2026
Merged

martin-martin merged 2 commits into
masterfrom
maintenance/instance-class-static-methods-20260916

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Companion-code sync for Python's Instance, Class, and Static Methods Demystified after this maintenance cycle.

What changed

pizza.py — the Pizza.get_size_in_inches() static method had drifted from the tutorial's listing:

  • Docstring restored to the article's wording: """Returns the diameter in inches for common pizza sizes.""" (the folder said "an approximate diameter in inches for common sizes").
  • size_map re-expanded to the article's one-key-per-line literal with a trailing comma, instead of the collapsed one-liner.

What deliberately did not change

  • demo.py already carried the colon on def static_method():, so this cycle's code-failure fix was article-only — no repo change needed.
  • The version-bump from python==3.13 to python==3.14 touches no file here: the folder is pure standard library, so there is no requirements.txt or constraints.txt for a reader to install from and nothing to re-pin.
  • The {% ref %} glossary links added this cycle are prose-only.
  • The two LOW pedagogical findings (the "enforced by the Python runtime" wording and raising instead of returning "Unknown size") were left for a human, so get_size_in_inches() keeps its sentinel return.

How this was verified

  • Fresh uv venv --python 3.14 (CPython 3.14.6), matching the draft's dependencies: python==3.14. No third-party packages are required.
  • demo.py and pizza.py both executed (MPLBACKEND=Agg) — both run clean.
  • Every code block and REPL session in the updated draft was replayed against these modules: all 22 expected outputs reproduce verbatim, including <demo.DemoClass object at 0x...>, <class 'demo.DemoClass'>, the TypeError: DemoClass.instance_method() missing 1 required positional argument: 'self' message, the Pizza([...]) reprs, the factory methods, and get_size_in_inches() returning 12, 8, and 16.
  • Repo gates at the version pinned in the root requirements.txt (ruff==0.14.1): uvx ruff@0.14.1 format --check instance-class-static-methods → "2 files already formatted"; uvx ruff@0.14.1 check instance-class-static-methods → "All checks passed!".

Needs a human merge.

realpython-bot and others added 2 commits September 16, 2026 14:56
…hon's Instance, Class, and Static Methods Demystified

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@martin-martin martin-martin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@martin-martin
martin-martin merged commit 8baa732 into master Sep 23, 2026
1 check passed
@martin-martin
martin-martin deleted the maintenance/instance-class-static-methods-20260916 branch September 23, 2026 10:23
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.

2 participants