Some class lambdas tests too assure that they are working well with instances.

This commit is contained in:
Dave Halter
2014-12-01 11:36:19 +01:00
parent 50752df6dd
commit 7c9de1fbeb

View File

@@ -55,11 +55,26 @@ a = lambda: 3
a.__closure__
class C():
def __init__(self):
def __init__(self, foo=1.0):
self.a = lambda: 1
self.foo = foo
def ret(self):
return lambda: self.foo
def with_param(self):
return lambda x: x + self.a()
#? int()
C().a()
#? str()
C('foo').ret()()
index = C().with_param()(1)
#? float()
['', 1, 1.0][index]
def xy(param):
def ret(a, b):