On Thursday, 27 December 2012 13:22:45 UTC+5:30, Chris Angelico wrote: > On Thu, Dec 27, 2012 at 6:46 PM, Abhas Bhattacharya > > <abhasbhattachar...@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: > > > > # foo.py > > def indirection(): > > return lambda: print > > > > # bar.py > > import foo > > foo.indirection()()("Hello, world!") > > > > What are the names of all the functions called here? > > > > ChrisA
Yes, I get it that it may not be possible in complex cases (mostly using lambda functions). But in the simple case I mentioned, is it possible? -- http://mail.python.org/mailman/listinfo/python-list