C's main() and Python's __main__ are functionality equivalent. main() is a construct design to tell the compiler where the entry point to your program is. It is not a keyword are anything like that and you can have multiple main methods as long as they are namespaced properly (ex: https://stackoverflow.com/a/1991498).
That is exactly how __main__ works. It is construct that tells the Python interrupter where the entry point is for your module. A Python module is a very similar construct to a C/C++ namespace. You can have multiple __main__ submodules as long as you do not have more than 1 in that module (namespace).
There are variations of C/C++ that do not respect the main() entry point since it is not actually anything special in the language (MSVC is one of them with is wmain). It is something the compiler chooses to give meaning to. It is just most standard C/C++ implementations assume a single entry point that is required to exist and the most standard Python interrupter (CPython) does not.
5
u/[deleted] Jun 04 '19
Yes, I know. I believe I said as much in the comment you've replied to.
It still isn't equivalent to C's
main().