(Apologies to Chris, reply vs. replay all error on my part)

> -----Original Message-----
> From: Chris Angelico <ros...@gmail.com>
> 
> People can already put all their main logic into a function. If you want
to unit-
> test your main function, that's the best way to do it.
> The trouble is, how much goes into main() and how much into if __name__
> == '__main__'? For example: Does your main function accept a list of
> arguments, or does it look in sys.argv? Neither answer is wrong. And that
> means the best way is to NOT force everyone across all of Python to choose
> the same way - let people write their code their way.
> 

People write main entry points that are not exactly this?

If __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))


Which is not to say this is the only use of the idiom about __name__ and
__main__, just that the community appears to be slowly converging on some
spelling of that.  I would be ok with some sugar for that spelling, but I
don't need it.  I would not be ok with getting rid of the current spelling.

> ChrisA
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org To unsubscribe send
> an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at https://mail.python.org/archives/list/python-
> id...@python.org/message/OYIJA7YRXRKEN3WMURTC4T2ZCKQBMTPV/
> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/PDU7NJXFKXCB6HFNJUGZAXNSHUNZ2U6Q/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to