What's the use of changing func_name?

C

could ildg

def a(func):
def _inner(*args, **kwds):
print "decorating..."
return func(*args, **kwds)
_inner.func_name = func.func_name -->when I delete this line, the
rusult is the same. why?
return _inner

@a
def g(*args):
for x in args:
print x
print "this is in function g"

g(1,2,3,4,5)

func_name is writable in python 2.4. I wonder what's the use of
writing it. Consider the code above, to change the func_name or not
will get the completely same result. The result is as
below:

decorating...
1
2
3
4
5
this is in function g

Please tell me how does this happen, thank you~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,239
Messages
2,571,200
Members
47,840
Latest member
Tiffany471

Latest Threads

Top