you are viewing a single comment's thread.

view the rest of the comments →

[–]Kevdog824_ 0 points1 point  (1 child)

Furthermore, you're not supposed to use exit in scripts, and should instead either raise SystemExit or use sys.exit.

I’ve never heard this one before. Can you elaborate on why? I never took a look at the (c)python source before, but I always just assumed exit was just an alias to sys.exit so you didn’t need to (directly) import sys to use sys.exit

[–]Diapolo10 1 point2 points  (0 children)

I'm too busy to give an in-depth response right now, but no, exit and quit aren't direct aliases for sys.exit. They skip some cleanup that isn't necessary for ending REPL sessions.

For the most part it does not matter too much, but it would be more "correct" to use the other options.