On Wed, Nov 12, 2014 at 3:09 PM, Chris Kaynor <[email protected]> wrote:
> I was thinking along the lines of replacing:
>
> if __name__ == "__main__":
> <<<block of code>>>
>
> with
>
> @main
> def myFunction()
> <<<<block of code>>
>
> Both blocks of code will be called at the same time.
99% of the time the content of <<<block of code>>> is just "main()",
so then you're proposing replacing this:
if __name__ == "__main__":
main()
with this:
@main
def myFunction():
my_main()
Which feels redundant to me. Why have a function here that does
nothing but call another function?
I think if this is the goal then a simple predicate would be clearer:
if is_main_module():
main()
--
https://mail.python.org/mailman/listinfo/python-list