decorator problem
contro opinion
contropinion at gmail.com
Mon Jan 9 23:14:10 EST 2012
More information about the Python-list mailing list
Mon Jan 9 23:14:10 EST 2012
- Previous message (by thread): decorator problem1:
- Next message (by thread): decorator problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
test1.py
def deco(func):
print 'i am in deco'
@deco
def test():
print 'i am in test'
when you run it ,you get :
i am in deco
test2.py
def tsfunc(func):
def wrappedFunc():
print 'i am in deco'
return func()
return wrappedFunc
@tsfunc
def test():
print "i am in test"
when you run test2.py,you can get nothing ,why can't i get :??
i am in deco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120110/50a6c4b2/attachment.html>
- Previous message (by thread): decorator problem1:
- Next message (by thread): decorator problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list