Skip to content

bpo-45198: __set_name__ documentation not clear about its usage with non-descriptor classes#28439

Merged
rhettinger merged 3 commits into
python:mainfrom
rhettinger:setname_docs
Sep 18, 2021
Merged

bpo-45198: __set_name__ documentation not clear about its usage with non-descriptor classes#28439
rhettinger merged 3 commits into
python:mainfrom
rhettinger:setname_docs

Conversation

@rhettinger
Copy link
Copy Markdown
Contributor

@rhettinger rhettinger commented Sep 18, 2021

  • Change descriptor specific wording and examples to cover the general case.
  • Fix broken example for calling __set_name__ directly. The example was descriptor specific and the invocation could fail because the descriptor would be triggered by the dotted lookup on the class.
  • Move the __set_name__ docs out of the descriptor section and into the general section on class creation.

https://bugs.python.org/issue45198

@rhettinger rhettinger merged commit 94b4626 into python:main Sep 18, 2021
@miss-islington
Copy link
Copy Markdown
Contributor

Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 18, 2021
…non-descriptor classes (pythonGH-28439)

(cherry picked from commit 94b4626)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
@miss-islington
Copy link
Copy Markdown
Contributor

Sorry, @rhettinger, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 94b462686b7dfabbd69cc9401037d736d71c4dc2 3.9

@bedevere-bot
Copy link
Copy Markdown

GH-28444 is a backport of this pull request to the 3.10 branch.

miss-islington added a commit that referenced this pull request Sep 18, 2021
…non-descriptor classes (GH-28439)

(cherry picked from commit 94b4626)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
niyas-sait pushed a commit to niyas-sait/cpython that referenced this pull request Sep 21, 2021
pablogsal pushed a commit that referenced this pull request Sep 29, 2021
…non-descriptor classes (GH-28439)

(cherry picked from commit 94b4626)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants