Cheers, Chris -- http://rebertia.com
On Mon, Jan 9, 2012 at 8:34 PM, contro opinion <contropin...@gmail.com> wrote: > > def deco(func): > def wrap(): > print 'i am in deco' > return func() > return wrap > > @deco > def test(): > print "i am in test" > when you run it ,there is no result , > > def deco(func): > print 'i am in deco' > return func() > > > @deco > def test(): > print "i am in test" > > > when you run it ,you can get : >>>> > i am in deco > i am in test > > why?? For the third time, it's because the "I am in deco" `print` is not within a nested function definition (such as wrap()). Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list