AttributeError: 'str' object has no attribute '__name__'
def log(f):
??? def fn(x):
??????? print 'call ' + f.__name__ + '()...'
??????? return f(x)
??? return fn
@log('DEBUG')
def my_func():
??? pass
def log(f):
??? def fn(x):
??????? print 'call ' + f.__name__ + '()...'
??????? return f(x)
??? return fn
@log('DEBUG')
def my_func():
??? pass
2015-05-14
舉報
2015-07-14
你定義的log是接受函數的,但是你又讓它接收'DEBUG'這種字符串,是要怎樣?。?/b>