Skip to content

gh-96397: Document that attributes need not be identifiers - #96454

Merged
gvanrossum merged 2 commits into
python:mainfrom
jeff5:doc-accept-nonid-attrs
Sep 29, 2022
Merged

gh-96397: Document that attributes need not be identifiers#96454
gvanrossum merged 2 commits into
python:mainfrom
jeff5:doc-accept-nonid-attrs

Conversation

@jeff5

@jeff5jeff5 commented Aug 31, 2022

Copy link
Copy Markdown
Contributor

Companion to #96393, and stemming from points made in the discussions at https://discuss.python.org/t/supporting-or-not-invalid-identifiers-in-kwargs/17147/26 and #96397, this proposes extending how we define "attribute" to match the behaviour of implementations and some current user practice.

Needs SC discussion, I believe.

Clarify that the name of an attribute need not be a valid Python identifier, in particular through setarr(), noting that this precludes use of the dot notation to access them.

@ChrisBarker-NOAAChrisBarker-NOAA 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.

Looks good to me -- I've suggested a bit more verbose text, but not critical.

Comment threadDoc/library/functions.rst
Comment threadDoc/library/functions.rst
Comment threadDoc/library/functions.rst
@jeff5

Copy link
Copy Markdown
ContributorAuthor

Could this be merged, or have I more to do?

@gvanrossumgvanrossum 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.

LGTM, one optional suggestion.

Comment threadDoc/glossary.rst Outdated
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
@gvanrossum
gvanrossum merged commit 9a11ed8 into python:mainSep 29, 2022
@gvanrossumgvanrossum added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Sep 29, 2022
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @jeff5 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @jeff5 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot

Copy link
Copy Markdown

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

@bedevere-botbedevere-bot removed needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Sep 29, 2022
@bedevere-bot

Copy link
Copy Markdown

GH-97659 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 29, 2022
…honGH-96454)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
(cherry picked from commit 9a11ed8)
Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 29, 2022
…honGH-96454)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
(cherry picked from commit 9a11ed8)
Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
miss-islington added a commit that referenced this pull request Sep 29, 2022
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
(cherry picked from commit 9a11ed8)
Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
miss-islington added a commit that referenced this pull request Sep 29, 2022
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
(cherry picked from commit 9a11ed8)
Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
serhiy-storchaka pushed a commit to serhiy-storchaka/cpython that referenced this pull request Oct 2, 2022
…hon#96454)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
pablogsal pushed a commit that referenced this pull request Oct 22, 2022
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
(cherry picked from commit 9a11ed8)
Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docsDocumentation in the Doc dirskip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@jeff5@miss-islington@bedevere-bot@merwok@ChrisBarker-NOAA@gvanrossum@CAM-Gerlach