On Wed, Feb 20, 2008, BJ?rn Lindqvist wrote:
An idea I have thought about for a while and it makes sense to me...
$ python Python 2.4.2 (#1, Oct 13 2006, 17:17:08) [GCC 4.1.0 (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
'Use Ctrl-D (i.e. EOF) to exit.'
Argh! Do what I mean, stupid Python! And it is Ctrl+Z on Windows, not Ctrl-D. So exit could be a statement that does the same thing that sys.exit() does currently. Bare "exit" to terminate with return code 0, and "exit X" to terminate with return code X.
Python 2.5.1 (r251:54863, Sep 27 2007, 12:17:47) [GCC 3.3.3 (NetBSD nb3 20040520)] on netbsd3 Type "help", "copyright", "credits" or "license" for more information.
Use exit() or Ctrl-D (i.e. EOF) to exit
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).