Skip to content

Instantly share code, notes, and snippets.

@maple42
maple42 / decorator_1.py
Created October 13, 2014 07:23
decorator of log
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import functools
def log(func):
@functools.wraps(func)
def wrapper(*args, **kw):
print 'begin call'
func(*args, **kw)
@maple42
maple42 / decorator_2.py
Created October 13, 2014 07:54
decorator of log
#!/usr/bin/env python
#_*_ conding:utf8 _*_
def log(string):
if isinstance(string,str):
def decorator(func):
def wrapper(*args,**kw):