On Tue, Dec 1, 2020 at 3:16 PM Paul Sokolovsky <pmis...@gmail.com> wrote:

> > 2. In order to maintain the distinction between "import time" and "run
> > time", will it be illegal to explicitly run __main__() in the __main__
> > module at import time? If not, would __main__() still be run (a
> > *second time*) at run time....?
>
> Even the "TL;DR" version gives the idiom to make an application (its
> main module) be compatible with both standard and strict mode. And full
> version gives the details of why it is so. That's pretty much the
> simple(st) method, why do you ask for something else?
>
> >
> > ```
> > __
> >
> > # import time section
> >
> > def __main__():
> >     # run time
> >     print("foo")
> >
> > __main__()
> > ```
> >
> > Is the output:
> >
> > foo
> > foo
>
> Yes, if run in the strict mode, the __main__() will be executed twice.
>

No not asking for something else, just wanted to make sure I understood.
Thanks!

---
Ricky.

"I've never met a Kentucky man who wasn't either thinking about going home
or actually going home." - Happy Chandler
_______________________________________________
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/4WU4TF4XXDO6FXZDIKRGPQDEB7BHOINW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to