mirror of https://github.com/python/cpython
gh-102302 Micro-optimize `inspect.Parameter.__hash__` (#102303)
This commit is contained in:
parent
c2bd55d26f
commit
90801e48fd
|
@ -2805,7 +2805,7 @@ class Parameter:
|
||||||
return '<{} "{}">'.format(self.__class__.__name__, self)
|
return '<{} "{}">'.format(self.__class__.__name__, self)
|
||||||
|
|
||||||
def __hash__(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):
|
def __eq__(self, other):
|
||||||
if self is 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…
Reference in New Issue