ch08, 09, 10: example files

This commit is contained in:
Luciano Ramalho
2020-06-11 14:58:15 -03:00
parent 42861b64d8
commit bf4a2be8b9
111 changed files with 4707 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
def first(f):
print(f'apply first({f.__name__})')
def inner1st(n):
result = f(n)
print(f'inner1({n}): called {f.__name__}({n}) -> {result}')
return result
return inner1st
def second(f):
print(f'apply second({f.__name__})')
def inner2nd(n):
result = f(n)
print(f'inner2({n}): called {f.__name__}({n}) -> {result}')
return result
return inner2nd
@first
@second
def double(n):
return n * 2
print(double(3))
def double_(n):
return n * 2
double_ = first(second(double_))
print(double_(3))