On 2021-05-25, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: > On Tue, 25 May 2021 19:21:39 +0200, hw <h...@adminart.net> declaimed the > following: > > >> >>Oh ok, it seemed to be fine. Would it be the right way to do it with >>sys.exit()? Having to import another library just to end a program >>might not be ideal. > > I've never had to use sys. for exit... > > C:\Users\Wulfraed>python > Python ActivePython 3.8.2 (ActiveState Software Inc.) based on > on win32 > Type "help", "copyright", "credits" or "license" for more information. >>>> exit() > > C:\Users\Wulfraed>python
According to the docs (and various other sources), the global variable "exit" is provided by the site module and is only for use at the interactive prompt -- it should not be used in programs. https://docs.python.org/3/library/constants.html#exit I get the impression that real programs should not assume that the site module has been pre-loaded during startup. -- Grant -- https://mail.python.org/mailman/listinfo/python-list