mirror of
https://github.com/python/cpython.git
synced 2025-12-05 00:52:25 +00:00
gh-102302 Micro-optimize inspect.Parameter.__hash__ (#102303)
This commit is contained in:
parent
c2bd55d26f
commit
90801e48fd
2 changed files with 2 additions and 1 deletions
|
|
@ -2805,7 +2805,7 @@ class Parameter:
|
|||
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:
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Micro-optimise hashing of :class:`inspect.Parameter`, reducing the time it takes to hash an instance by around 40%.
|
||||
Loading…
Add table
Add a link
Reference in a new issue