3 ms·
I would expect sys.exit() to be more efficient since it skips the final GC and calls to finalizers. Sys is always already imported, so 'import sys' amounts to a
by marshray 7y ago
I would expect sys.exit() to be more efficient since it skips the final GC and calls to finalizers. Sys is always already imported, so 'import sys' amounts to a dict lookup.
These are not the same semantically. It may or may not be practical for you to prove that your program is still correct if finalizers are skipped.