Skip to content

Commit

Permalink
gh-102302 Micro-optimize inspect.Parameter.__hash__ (#102303)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gouvernathor committed Mar 4, 2023
1 parent c2bd55d commit 90801e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2805,7 +2805,7 @@ def __repr__(self):
return '<{} "{}">'.format(self.__class__.__name__, self)

def __hash__(self):
return hash((self.name, self.kind, self.annotation, self.default))
return hash((self._name, self._kind, self._annotation, self._default))

def __eq__(self, other):
if self is other:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Micro-optimise hashing of :class:`inspect.Parameter`, reducing the time it takes to hash an instance by around 40%.

0 comments on commit 90801e4

Please sign in to comment.