example-code-2e/09-closure-deco/registration_abridged.py
2020-06-11 14:58:15 -03:00

17 lines
286 B
Python

# tag::REGISTRATION_ABRIDGED[]
registry = []
def register(func):
print(f'running register({func})')
registry.append(func)
return func
@register
def f1():
print('running f1()')
print('running main()')
print('registry ->', registry)
f1()
# end::REGISTRATION_ABRIDGED[]