Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__slots__ as a dict is not documented in the data model docs. #114044

Closed
ericvsmith opened this issue Jan 13, 2024 · 3 comments
Closed

__slots__ as a dict is not documented in the data model docs. #114044

ericvsmith opened this issue Jan 13, 2024 · 3 comments
Labels
docs Documentation in the Doc dir

Comments

@ericvsmith
Copy link
Member

ericvsmith commented Jan 13, 2024

Starting with 3.8, __slots__ can be a dict, mapping slot names to docstrings. See https://docs.python.org/3/whatsnew/3.8.html#inspect

However, https://docs.python.org/3/reference/datamodel.html does not mention this, but it should.

This came up in issue #113878 for adding docstrings to slots in dataclasses.

@AlexWaygood
Copy link
Member

AlexWaygood commented Jan 13, 2024

The data-model docs do mention this, in the fourth-from-last bullet point on __slots__. I added docs for it in

(See discussion in that PR for why it was decided not to have more prominent documentation for this feature.)

@AlexWaygood
Copy link
Member

@rhettinger, I'm somewhat confused by your comment in #113878 (comment), since you reviewed that PR :)

@ericvsmith
Copy link
Member Author

Ah, good point @AlexWaygood. I clearly didn't read far enough, and it's true that a dict with str keys is an iterable of strings.

@ericvsmith ericvsmith closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2024
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
Projects
None yet
Development

No branches or pull requests

2 participants