Contents

Lec8-Function Example

Function Example

1

1
2
3
4
5
def delay(arg):
    print('delayed')
    def g():
        return arg
    return g

/lec8-function-example/image.png

2

1
2
3
4
5
def pirate(arggg):
    print('matey')
    def plunder():
        return arggg
    return plunder

/lec8-function-example/image-1.png

3 horse mask

关键是两条红线

/lec8-function-example/image-2.png

装饰器

本质上是一个HoF

/lec8-function-example/image-4.png

/lec8-function-example/image-3.png