Finding the name of a function while defining it
rosuav at gmail.com
Thu Dec 27 08:52:45 CET 2012
On Thu, Dec 27, 2012 at 6:46 PM, Abhas Bhattacharya
<abhasbhattacharya2 at gmail.com> wrote:
> [ a whole lot of double-spaced quoted text - please trim it ]
> If i call one() and two() respectively, i would like to see "one" and "two".
That completely goes against your idea of knowing at compile-time,
because the name "two" isn't anywhere around at that time.
There's no way to know what name was used to look something up. It
might not even have a name - the called function could well have been
returned from another function:
return lambda: print
What are the names of all the functions called here?
More information about the Python-list