Skip to content

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

Closed as not planned

Description

@ericvsmith

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.

Activity

  1. AlexWaygood commented on Jan 13, 2024

    @AlexWaygood
    Member

    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.)

  2. AlexWaygood commented on Jan 13, 2024

    @AlexWaygood
    Member

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

  3. ericvsmith commented on Jan 13, 2024

    @ericvsmith
    MemberAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions