On Thursday, 27 December 2012 13:18:19 UTC+5:30, Chris Angelico wrote: > On Thu, Dec 27, 2012 at 6:26 PM, Abhas Bhattacharya > > <abhasbhattachar...@gmail.com> wrote: > > > During run-time, I can always use: function_name.__name__ (although that's > > kind of lame because it returns "function_name"). But if the function > > itself contains print(__name__) and I call the function, it returns > > __main__ (yes, __main__ itself, not the string "__main__") (which is the > > calling function). > > > > That's because __name__ looks for that attribute on the module (aka > > "global variable"), not the function. When you run your Python script > > as an application, the module is called __main__. > > > > ChrisA
Ok, that sheds some light on why it acts like that, but how can i use it the way I want (which i already told)? -- http://mail.python.org/mailman/listinfo/python-list