You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
260 B
25 lines
260 B
10 years ago
|
# test decorators
|
||
|
|
||
|
def dec(f):
|
||
|
print('dec')
|
||
|
return f
|
||
|
|
||
|
def dec_arg(x):
|
||
|
print(x)
|
||
|
return lambda f:f
|
||
|
|
||
|
# plain decorator
|
||
|
@dec
|
||
|
def f():
|
||
|
pass
|
||
|
|
||
|
# decorator with arg
|
||
|
@dec_arg('dec_arg')
|
||
|
def g():
|
||
|
pass
|
||
|
|
||
|
# decorator of class
|
||
|
@dec
|
||
|
class A:
|
||
|
pass
|