Back on python for the AMIGA again and discovered this little gem...

I am back on Python for the AMIGA again and discovered this little gem that exits the program:-
(If you search GOOGLE as 'os.sys.exit()' python nothing seems to appear.)

import os
os.sys.exit()

I know of the other four and how they apply but I have no idea whether this creates any zombies or memory holes or whatever.

import os
import sys
"""
sys.exit()
os._exit()
exit()
quit()
"""

Just thought you might like to know guys as I still code for the lowly AMIGA and its latest version of Python is an unreliable Version 2.4.6 and its earliest is 1.4.0 which I use a lot still...
The code in the top code block works from Version 1.4.0 on the AMIGA and an installed 3.5.2 on my MBP.

These are great posts! Thanks.

I used to love to program on the Amiga, including the years when I was a land surveyor and wrote a lot of land surveying programs on the Amiga (as well as a Tandy TRS 80 as I recall) which I used in my business, and your posts brings back fond, distant memories.

As an addendum to this thread assigning 'sys' to 'os.sys' opens up 'sys' without wasting namespace by importing 'sys' at all IF 'os' is already imported.
Demo code:

import os
print("")
print(dir(os.sys))
# import sys    # This is not needed if os is imported!

# Instead of taking up namespace by import[ing] sys, assign sys to os.sys in its place.
sys = os.sys

# A few simple 'sys' functions in action.
print("")
print(sys.platform)
print("")
print(sys.version)
print("")
print(sys.builtin_module_names)
print("")
sys.stdout.write("Hello unix.com!")
print("")
print("")
print(sys.modules)
print("")
sys.exit(10)

Results, OSX 10.14.3, default bash terminal calling python3.5...

Last login: Mon Jul  8 16:30:25 on ttys000
AMIGA:amiga~> cd Desktop/Code/Python
AMIGA:amiga~/Desktop/Code/Python> python3.5 os_sys.py

['__displayhook__', '__doc__', '__excepthook__', '__interactivehook__', '__loader__', '__name__', '__package__', '__spec__', '__stderr__', '__stdin__', '__stdout__', '_clear_type_cache', '_current_frames', '_debugmallocstats', '_getframe', '_home', '_mercurial', '_xoptions', 'abiflags', 'api_version', 'argv', 'base_exec_prefix', 'base_prefix', 'builtin_module_names', 'byteorder', 'call_tracing', 'callstats', 'copyright', 'displayhook', 'dont_write_bytecode', 'exc_info', 'excepthook', 'exec_prefix', 'executable', 'exit', 'flags', 'float_info', 'float_repr_style', 'get_coroutine_wrapper', 'getallocatedblocks', 'getcheckinterval', 'getdefaultencoding', 'getdlopenflags', 'getfilesystemencoding', 'getprofile', 'getrecursionlimit', 'getrefcount', 'getsizeof', 'getswitchinterval', 'gettrace', 'hash_info', 'hexversion', 'implementation', 'int_info', 'intern', 'is_finalizing', 'maxsize', 'maxunicode', 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache', 'platform', 'prefix', 'set_coroutine_wrapper', 'setcheckinterval', 'setdlopenflags', 'setprofile', 'setrecursionlimit', 'setswitchinterval', 'settrace', 'stderr', 'stdin', 'stdout', 'thread_info', 'version', 'version_info', 'warnoptions']

darwin

3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:47:25) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]

('_ast', '_codecs', '_collections', '_functools', '_imp', '_io', '_locale', '_operator', '_signal', '_sre', '_stat', '_string', '_symtable', '_thread', '_tracemalloc', '_warnings', '_weakref', 'atexit', 'builtins', 'errno', 'faulthandler', 'gc', 'itertools', 'marshal', 'posix', 'pwd', 'sys', 'time', 'xxsubtype', 'zipimport')

Hello unix.com!

{'zipimport': <module 'zipimport' (built-in)>, '_sitebuiltins': <module '_sitebuiltins' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_sitebuiltins.py'>, 'encodings.latin_1': <module 'encodings.latin_1' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/encodings/latin_1.py'>, 'codecs': <module 'codecs' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/codecs.py'>, 'sre_compile': <module 'sre_compile' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/sre_compile.py'>, 'os': <module 'os' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/os.py'>, '_warnings': <module '_warnings' (built-in)>, '_signal': <module '_signal' (built-in)>, 'encodings': <module 'encodings' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/encodings/__init__.py'>, '_weakrefset': <module '_weakrefset' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_weakrefset.py'>, 'builtins': <module 'builtins' (built-in)>, '_locale': <module '_locale' (built-in)>, '_imp': <module '_imp' (built-in)>, '_stat': <module '_stat' (built-in)>, 'os.path': <module 'posixpath' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/posixpath.py'>, 'sre_parse': <module 'sre_parse' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/sre_parse.py'>, 'genericpath': <module 'genericpath' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/genericpath.py'>, 'stat': <module 'stat' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/stat.py'>, 'sys': <module 'sys' (built-in)>, '_frozen_importlib_external': <module '_frozen_importlib_external' (frozen)>, '_codecs': <module '_codecs' (built-in)>, 'sysconfig': <module 'sysconfig' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/sysconfig.py'>, '_osx_support': <module '_osx_support' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_osx_support.py'>, '_frozen_importlib': <module '_frozen_importlib' (frozen)>, '_sre': <module '_sre' (built-in)>, 'abc': <module 'abc' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/abc.py'>, 'encodings.aliases': <module 'encodings.aliases' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/encodings/aliases.py'>, '_bootlocale': <module '_bootlocale' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_bootlocale.py'>, '_io': <module 'io' (built-in)>, 're': <module 're' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/re.py'>, 'marshal': <module 'marshal' (built-in)>, '_sysconfigdata': <module '_sysconfigdata' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_sysconfigdata.py'>, 'copyreg': <module 'copyreg' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/copyreg.py'>, '_thread': <module '_thread' (built-in)>, 'encodings.utf_8': <module 'encodings.utf_8' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/encodings/utf_8.py'>, 'posixpath': <module 'posixpath' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/posixpath.py'>, 'io': <module 'io' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/io.py'>, 'sre_constants': <module 'sre_constants' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/sre_constants.py'>, 'errno': <module 'errno' (built-in)>, '__main__': <module '__main__' from 'os_sys.py'>, 'posix': <module 'posix' (built-in)>, '_weakref': <module '_weakref' (built-in)>, 'site': <module 'site' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site.py'>, '_collections_abc': <module '_collections_abc' from '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/_collections_abc.py'>}

AMIGA:amiga~/Desktop/Code/Python> echo $?
10
AMIGA:amiga~/Desktop/Code/Python> _