Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5334bcd commit 0ba5f0dCopy full SHA for 0ba5f0d
1 file changed
Lib/inspect.py
@@ -1905,6 +1905,17 @@ def __repr__(self):
1905
id(self), self.name)
1906
1907
def __eq__(self, other):
1908
+ # NB: We deliberately do not compare '_partial_kwarg' attributes
1909
+ # here. Imagine we have a following situation:
1910
+ #
1911
+ # def foo(a, b=1): pass
1912
+ # def bar(a, b): pass
1913
+ # bar2 = functools.partial(bar, b=1)
1914
1915
+ # For the above scenario, signatures for `foo` and `bar2` should
1916
+ # be equal. '_partial_kwarg' attribute is an internal flag, to
1917
+ # distinguish between keyword parameters with defaults and
1918
+ # keyword parameters which got their defaults from functools.partial
1919
return (issubclass(other.__class__, Parameter) and
1920
self._name == other._name and
1921
self._kind == other._kind and
0 commit comments