code1:

def FirstDeco(func):
   print 'haha'
   y=func()
   return y
   print  y


@FirstDeco
def test():
  print 'asdf'
  return  7

result :
haha
asdf

code2:

def FirstDeco(func):
   print 'haha'
   y=func()
   #return y
   print  y


@FirstDeco
def test():
  print 'asdf'
  return  7

result :
haha
asdf
7

why the result of code1 and code2  is different?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to