example-code-2e/07-closure-deco/registration_abridged.py
2015-04-01 22:48:56 -03:00

17 lines
284 B
Python

# BEGIN REGISTRATION_ABRIDGED
registry = []
def register(func):
print('running register(%s)' % func)
registry.append(func)
return func
@register
def f1():
print('running f1()')
print('running main()')
print('registry ->', registry)
f1()
# END REGISTRATION_ABRIDGED