You are on page 1of 2

#5.

Python: .
1.
. simpledecs.py paramdecs.py
.
, . ,
Python , ..
def ..
Creating decorator...
student@student:~/some/path> python simpledecs.py
Creating decorator... # 25
We're inside first test function. # 23 33
Creating decorator... # 13 35
Function first_test_func will be launched now # 15
37
We're inside first test function. # 23 16
37
Function second_test_func will be launched now... # 15
38
We're inside second test function. # 30 16
38
python paramdecs.py
student@student:~/some/path> python paramdecs.py
We're inside outer function and will create parametrized decorator now.
Creating decorator...
I'm string
We're inside outer function and will create parametrized decorator now.
Creating decorator...
Function string_func will be launched now. It's argument (I'm string) will
be shifted by PREFIX
PREFIX I'm string
Function number_func will be launched now. It's argument (3) will be shifted
by 10
13
. .
, f ,

-
. ,
None, .
, f
.
isinstance(val, t),
True, val t False .
5/hw .
.
1. , Python, 3- , -, 2009.
2. Marty Alchin, Pro Python, Apress, 2010 - 3 Functions,
Decorators.

You might also like