Sullivan WxPyQtKinter wrote:
> I am sorry but you misunderstood my idea.
> What I want is a generalized method to print out the function name, or
> refer to the name of a function. If I use f.__name__, I think I should
> just use print "f" to save my keyboard. What I expect is using a
> method, or
Sullivan WxPyQtKinter wrote:
> I am sorry but you misunderstood my idea.
> What I want is a generalized method to print out the function name, or
> refer to the name of a function. If I use f.__name__, I think I should
> just use print "f" to save my keyboard. What I expect is using a
> method, or
Sullivan WxPyQtKinter wrote:
If I would like to refer to the function object in order
> to call it recursively, what shall I do then?
I think the question is too simple. You can just refer to the function
by its name. Here is an example:
py> def f(start, end):
... if start >= end:
... pri
I am sorry but you misunderstood my idea.
What I want is a generalized method to print out the function name, or
refer to the name of a function. If I use f.__name__, I think I should
just use print "f" to save my keyboard. What I expect is using a
method, or attribute, or another function to get t
Sullivan WxPyQtKinter wrote:
> So how
> could I refer to the function object per se, in the body of the
> function itself?
Just use the name.
def f():
print f.__name__
>>> f()
f
--
http://mail.python.org/mailman/listinfo/python-list
Sullivan WxPyQtKinter wrote:
> I have Google the whole thing and find another way for alternative
> implementation of getting the function's name. But all they returns are
> just strings. If I would like to refer to the function object in order
> to call it recursively, what shall I do then?
>
a
I have Google the whole thing and find another way for alternative
implementation of getting the function's name. But all they returns are
just strings. If I would like to refer to the function object in order
to call it recursively, what shall I do then?
--
http://mail.python.org/mailman/listinf
Sullivan WxPyQtKinter wrote:
> So how
> could I refer to the function object per se, in the body of the
> function itself?
>
>
I don't believe you can easily get at the function object, but you can get
at the code object which also has a name (which will be the same as the
function's name unles
When debugging using 'print' statement, I usually want to print some
important values together with the function name as the context of the
values printed out. So my hope is that I could get the name of the
function.
Since every function object actually has a private __name__ attribute
that gives