Robert Kern <[EMAIL PROTECTED]> writes:
> could ildg wrote:
> > Thank you for your help.
> > I know the function g is changed after setting the func_name.
> > But I still can't call funciton g by using f(), when I try to do
> > this, error will occur:
> >
> >
> g.func_name="f"
> print g
Thanks to Robert Kern.
You mean that though we can change the func_name of a function,
but we still can't call it by func_name, and the func_name is only
useful in some other circumstances?
I also think so now after I have tried so many times on this puzzled func_name
property.
On 5/19/05, Robert K
could ildg wrote:
> Thank you for your help.
> I know the function g is changed after setting the func_name.
> But I still can't call funciton g by using f(), when I try to do
> this, error will occur:
>
>
g.func_name="f"
print g
>
>
>
f()
>
> Traceback (most recent call last):
>
could ildg wrote:
> Thank you for your help.
> I know the function g is changed after setting the func_name.
> But I still can't call funciton g by using f(), when I try to do
> this, error will occur:
>
> >>> g.func_name="f"
> >>> print g
>
> >>> f()
> Traceback (most recent call last):
> File
could ildg wrote:
> Thank you for your help.
> I know the function g is changed after setting the func_name.
> But I still can't call funciton g by using f(), when I try to do
> this, error will occur:
>
>
g.func_name="f"
print g
>
>
>
f()
>
> Traceback (most recent call last):
>
Thank you for your help.
I know the function g is changed after setting the func_name.
But I still can't call funciton g by using f(), when I try to do
this, error will occur:
>>> g.func_name="f"
>>> print g
>>> f()
Traceback (most recent call last):
File "", line 1, in ?
NameError: name 'f' is
could ildg wrote:
> 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:
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 fu