def __main__() at the end of the file will be something nice to have. It’s much easier to explain to new students than if __name__ == __main__: main(). Can we import this new __main__ function from another file and use it in another file? Maybe it should be disallowed to remove confusion and conflict or only allowed if it was imported as another name (e.g. from file_b import __main__ as main_b) It would take optional arguments like number of command line arguments and the command line arguments as a list similar to C and C++: def __main__(argc: int, argv: list[str]): … Abdulla Sent from my iPhone
On 2 Oct 2021, at 10:43 AM, Chris Angelico <rosuav@gmail.com> wrote:
On Sat, Oct 2, 2021 at 3:15 PM Jonathan Crall <erotemic@gmail.com> wrote:
That's effectively every module I write. I don't think that's uncommon or bad practice.
Interesting. Why is that?
ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/6URF34... Code of Conduct: http://python.org/psf/codeofconduct/