[Tutor] Why use main() ?

Danny Yoo danny.yoo at gmail.com
Wed Jul 5 21:50:38 EDT 2017

In most cases, my scripts tend to be pretty self-contained and written
for my own purposes, so that would rarely be an issue.

How would you hide main() if you _were_ concerned about it?

The "main" option would be to move the body of main() to a separate file,
which imports the original file as a module.

There's alternative trickery that we can do in Python involving "delete",
but I'd steer clear of that, as that approach is a bit overkill.

More information about the Tutor mailing list