Google has a Python tutorial, and they describe boilerplate code as \"unfortunate\" and provide this example:
#!/usr/bin/python
# import modules used here -- sy
Let’s take a moment to see what happened when you called import sys:
sys moduleargv function and runs itSo, what’s happening here?
A function written elsewhere is being used to perform certain operations within the scope of the current program. Programming in this fashion has a lots of benefits. It separates the logic from actual labour.
Now, as far as the boilerplate is concerned, there are two parts:
main, and main existsYou essentially write your program under main, using all the functions you defined just before defining main (or elsewhere), and let Python look for main.