3 ms·
This is commonly used in python modules which can also be run by command line. http://effbot.org/pyfaq/tutor-what-is-if-name-main-for.htm http://effbot.org/pyf
by csytan 17y ago
This is commonly used in python modules which can also be run by command line.
http://effbot.org/pyfaq/tutor-what-is-if-name-main-for.htm http://effbot.org/pyfaq/tutor-what-is-if-name-main-for.htm
I do agree though, it would be better to remove the if statement altogether since it's unlikely to be imported as a module.
- deleted 17y ago[deleted]
- the_mitsuhiko 17y agoWell, the run() function was intended to be a very bad example of API. Because there is that magical application object you never see that run magically picks up. There is another example of really bad API in denied: there is a template render function internally (you have to read the code behind the code to see that) which magically accepts both filenames for templates and template source strings. And there are a couple of more examples of really, really bad ideas in that code.