Skip to content

PEP 767: Address feedback & open issues#4559

Merged
JelleZijlstra merged 11 commits into
python:mainfrom
Enegg:pep-767
Mar 11, 2026
Merged

PEP 767: Address feedback & open issues#4559
JelleZijlstra merged 11 commits into
python:mainfrom
Enegg:pep-767

Conversation

@Enegg

@Enegg Enegg commented Aug 25, 2025

Copy link
Copy Markdown
Contributor
  • Added my real name 🫠
  • Updated Post-History
  • Bikeshedded on some of the wording in this PEP
  • Clarified that use of bare ReadOnly is not allowed, and added that to rejected ideas
  • Specified that a protocol's read-only attributes are not accessible from its type (type[Protocol])
  • Closed open issue: "Extending Initialization"

📚 Documentation preview 📚: https://pep-previews--4559.org.readthedocs.build/

Clarify that bare `ReadOnly` is not allowed, and add that to rejected ideas
Specify that `type[Protocol]` does not inherit the protocol's attributes
Close issue: "Extending Initialization"
Bikeshed on some wording
Use my real name
@Enegg Enegg requested a review from carljm as a code owner August 25, 2025 15:31
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where are we up to with this PR? Can we merge it? Let's do so if there's no further feedback in ~a week.

Comment thread peps/pep-0767.rst Outdated
Enegg and others added 4 commits February 26, 2026 20:40
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
"Terminology" section
allow initializing read-only attributes by subclass
allow `@classmethod` to initialize instance attributes
allow `ReadOnly` + `Final`, though redundant
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst Outdated
Enegg added 2 commits March 9, 2026 23:27
Improve init rules regarding `__new__` and classmethods
Address Carl's comments

@carljm carljm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is looking pretty good to me! A few thoughts after another read-through.

Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst
Comment thread peps/pep-0767.rst Outdated
Comment thread peps/pep-0767.rst
Clarify that inheriting from a protocol makes it behave like a nominal class (wrt ReadOnly)
@carljm carljm requested a review from hugovk March 11, 2026 05:11
@carljm

carljm commented Mar 11, 2026

Copy link
Copy Markdown
Member

@hugovk not sure if the protocol here is for me as sponsor to just merge, or to get another once-over from a PEP editor? I'm happy for this to go in.

@JelleZijlstra

Copy link
Copy Markdown
Member

It's fine to just merge it! If you don't mind I'll read through it too though.

@JelleZijlstra JelleZijlstra merged commit 6f2e691 into python:main Mar 11, 2026
5 checks passed
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.

5 participants