On Sat, Oct 02, 2021 at 10:17:12AM -0700, Paul Bryan wrote:
As I understand, the arguments for: - let's get rid of boilerplate, that many (esp. beginners) may not understand
The proposal doesn't get rid of boilerplate, it just changes it from one form to another. The current idiom uses an explicit if test `if __name__ == "__main__"` which would be replaced by some other boilerplate. Some of the proposals have included: def main(): ... __main__(main) or import sys def main(): ... sys.run_main() or just an implicit magic dunder function: def __main__(): ... Whichever proposal we go with, its still boilerplate. Boilerplate is not necessarily bad. Boilerplate code is predictable, standardized code that can be easily reused with little or no variation. Predictable and standardized is another way of saying *idiomatic*, which is a good thing. Boilerplate is only bad when you have to write a lot of boilerplate to get to the small amount of code that actually solves your problem. Another name for that is scaffolding. Python (unlike some languages) rarely has a problem with excessively verbose scaffolding, and a one or two line idiomatic snippet to run code as a script is hardly excessively verbose. -- Steve