Skip to content

Conversation

@henryiii
Copy link
Contributor

This is a small performance improvement (1.7%), might reduce memory a bit, and could help against typos, like someone trying to assign to the _version attribute, which does nothing now.

Copy link
Member

@notatallshaw notatallshaw left a comment

Choose a reason for hiding this comment

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

In pip we already use __slots__ in performance critical classes, it was actually a surprise to see it missing from Version in packaging.

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
@henryiii henryiii force-pushed the henryiii/perf/slots branch from fe2dc74 to f144771 Compare November 27, 2025 20:32
@henryiii henryiii merged commit 7dd3b68 into pypa:main Nov 27, 2025
40 checks passed
@henryiii henryiii deleted the henryiii/perf/slots branch November 27, 2025 20:38
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.

2 participants