Finding the name of a function while defining it

Tim Roberts timr at
Sat Dec 29 06:01:22 CET 2012

Abhas Bhattacharya <abhasbhattacharya2 at> wrote:
>Now, for your questions:
>If i call one() and two() respectively, i would like to see "one" and "two".
>I dont have much knowledge of lambda functions, neither am i going to use
>them, so that's something I cant answer.

My point is not that these are special cases to consider, but rather that
all of these are the GENERAL case.  A function, now matter how it was
created, is an anonymous object that lives out in object space.  Like all
objects, a function object can be bound to many different names.  An object
doesn't know just one name, and when a function object is invoked, it has
NO IDEA what name was used to invoke it.  The information is simply not
Tim Roberts, timr at
Providenza & Boekelheide, Inc.

More information about the Python-list mailing list