Terms of the offer
The Python approach to " main " is almost unique to the language ("). The semantics are a bit subtle. The __name__ identifier is bound to the name of any module as it's being imported. However, when a file is being executed then __name__ is set to "__main__" (the literal string: __main__). This is almost always used to separate the portion of code which should be executed from the portions of code which define functionality. So Python code often contains a line like: #!/usr/bin/env python from ... What the supposed duplicate doesn't answer: having a main () function (instead of just writing all the code into the "if name" block) is useful because it avoids accidentally creating global variables that could affect other functions. What is the correct (most efficient) way to define the main () function in C and C++ — int main () or void main () — and why? And how about the arguments? If int main () then return 1 or return 0? The interesting part is "with no parameters". int main () and int main (void) are currently equivalent, since they are both function declarators and have no parameters. The following applies (6.7.6.3 ): 10 The special case of an unnamed parameter of type void as the only item in the list specifies that the function has no parameters. /--/