[Python-ideas] exit as a statement

Christian Heimes lists at cheimes.de
Wed Feb 20 17:10:50 CET 2008

Aahz wrote:
> This is essential because we do NOT want to add a new statement; however,
> we can make ``exit`` an object with a repr() that tells people to call
> it.  IIRC, on Windows, it does say "Ctrl-Z" -- but it doesn't matter,
> because IIRC Ctrl-D does work on Windows.  (I won't bother to fire up my
> Windows box to check.)
> In theory, we could make ``exit`` a property() that raises SystemExit,
> but that seems to magical for my taste (and other people agreed).

You are right and you are wrong. :] On Windows the repr of the exit
object says the right thing. But CTRL+D <enter> doesn't work on Windows.
Only CTRL+Z <enter> works.

Python 2.6a0 (trunk-math:60904M, Feb 19 2008, 17:58:34) [MSC v.1500 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
Use exit() or Ctrl-Z plus Return to exit
>>> ^D
  File "<stdin>", line 1
SyntaxError: invalid syntax
>>> ^Z


More information about the Python-ideas mailing list