forked from nagesh21/Python3
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecorator
More file actions
Latest commit
20 lines (17 loc) · 391 Bytes
/
Copy pathDecorator
File metadata and controls
20 lines (17 loc) · 391 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Example 1: Create simple decorator
def create_decorate(dec):
print('hi!')
dec()
print('hi! Decorate Created.')
@create_decorate
def my_function():
print('Now Decorate Create')
# Example 2: Pass arguments in decorator
import platform
def dec(pass_arg):
print('OS Name:')
osname = platform.system()
pass_arg(osname)
@dec
def fun(osname):
print(osname)