Fix an issue with partial keyword inputs.

This commit is contained in:
Dave Halter
2014-08-14 12:24:54 +02:00
parent 1540ac89f8
commit 425290aa8f
2 changed files with 10 additions and 3 deletions

View File

@@ -6,4 +6,4 @@ class partial():
def __call__(self, *args, **kwargs):
# I know this doesn't work in Python, but in Jedi it does ;-)
return self.__func(*self.__args, *args, **self.keywords, **kwargs)
return self.__func(*self.__args, *args, **self.__keywords, **kwargs)

View File

@@ -78,15 +78,22 @@ basetwo = functools.partial(int, base=2)
#? int()
basetwo()
def a(a, b):
def function(a, b):
return a, b
a = functools.partial(a, 0)
a = functools.partial(function, 0)
#? int()
a('')[0]
#? str()
a('')[1]
kw = functools.partial(function, b=1.0)
tup = kw(1)
#? int()
tup[0]
#? float()
tup[1]
def my_decorator(f):
@functools.wraps(f)
def wrapper(*args, **kwds):