“Boilerplate” code in Python?

后端 未结 6 757
终归单人心
终归单人心 2021-02-01 03:07

Google has a Python tutorial, and they describe boilerplate code as \"unfortunate\" and provide this example:

#!/usr/bin/python

# import modules used here -- sy         


        
6条回答
  •  滥情空心
    2021-02-01 03:30

    1) main boilerplate is common, but cannot be any simpler

    2) main() is not called without the boilerplate

    3) the boilerplate allows module usage both as a standalone script, and as a library in other programs

    4) it’s very common. doctest is another one.

    Train to become a Python guru…and good luck with the thesis! ;-)

提交回复
热议问题