Skip to content

Commit 90801e4

Browse files
authored
gh-102302 Micro-optimize inspect.Parameter.__hash__ (#102303)
1 parent c2bd55d commit 90801e4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Lib/inspect.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2805,7 +2805,7 @@ def __repr__(self):
28052805
return '<{} "{}">'.format(self.__class__.__name__, self)
28062806

28072807
def __hash__(self):
2808-
return hash((self.name, self.kind, self.annotation, self.default))
2808+
return hash((self._name, self._kind, self._annotation, self._default))
28092809

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

0 commit comments

Comments
 (0)