a question about decorator

kyo guan kyoguan at gmail.com
Mon Oct 22 08:37:36 CEST 2007


	please look at this code.

def A():
	print 'warp in A'
	def why(self, *arg, **kw):
		print 'in A'
		print self
		print arg
		print kw
		#self(*arg, **kw)
	return why
class T(object):
	def test(g, out):
		print 'in test', out

it will out put:

warp in A
in A
<function test at 0x00BF0C70>

the function why will be called, why? there is no code to call it.


More information about the Python-list mailing list