doubt regarding main function

praba kar prabapython at yahoo.co.in
Thu Apr 7 07:38:52 EDT 2005


Dear All,

    I have doubt regarding main function in
Python.  In Python we can create a function
and we can call a function directly.
(eg:)
def test():
    print 'main function test'
I can call this function the following way

eg) test()

So why we need the below way of calling a
function?

if __name__ == '__main__':
     test() 

What is the advantage of this way calling a
function.

Kindly mail me as early as possible

regards,
Prabahar



________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony



More information about the Python-list mailing list