
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.
exit '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. -- mvh Björn

This goes against the idea of keeping the language small. Believe me, it's been discussed to death, and the behavior you see now is the solid outcome of that discussion. On Feb 20, 2008 7:22 AM, BJörn Lindqvist <bjourne@gmail.com> wrote:
-- --Guido van Rossum (home page: http://www.python.org/~guido/)

This has been discussed to death several times before. I remember the rationale against doing something different to have various reasons. No one likes adding statements, for one thing (we have a tendency to move things out of keyword-space, not into it). Another solution was to define an ExitType with __str__ defined to raise SystemExit, but then what happens if you just do something to dump a bunch of objects? In other words: a side effect exiting is dangerous. As far as an actual statement, I'd definitely be -1 with a single exception. Would it be possible to define exit as an interpreter command, so long as the name 'exit' is not bound to anything but the exit str? In other words, it would only actually exit when you are in the interpreter, not when executing scripts or modules. On Feb 20, 2008, at 10:22 AM, BJörn Lindqvist wrote:

On Wed, Feb 20, 2008 at 4:51 PM, Calvin Spealman <ironfroggy@socialserve.com> wrote:
This has been discussed to death several times before. I remember the rationale against doing something different to have various reasons.
I haven't seem the statement idea discussed before.
No one likes adding statements, for one thing (we have a tendency to move things out of keyword-space, not into it).
What would the disadvantages of adding exit as a statement be? Would it make Python worse? Is there any other non-magical and straightforward solution to make exit to "do what I mean"? -- mvh Björn

On Feb 20, 2008 11:45 AM, BJörn Lindqvist <bjourne@gmail.com> wrote:
I hear you.. I keep typing exit_now_you_stupid_excuse_of_an_interpreter but it doesn't do what I mean! Seriously, pressing Ctrl-D/Ctrl-Z is not that much of a trouble to justify the bandwidth used for this thread. George

BJörn Lindqvist wrote:
We are trying hard to reduce the amount of statements and builtins. exit as a statement isn't worth the extra code. There are already plenty of ways to exit an interpreter process: sys.exit() os._exit() raise SystemExit exit() (interactive prompt) CTRL+Z or CTRL+D (interactive prompt) Christian

On Wed, Feb 20, 2008, BJ?rn Lindqvist wrote:
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.
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). -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ "All problems in computer science can be solved by another level of indirection." --Butler Lampson

Aahz wrote:
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.
Christian

On Wed, Feb 20, 2008 at 04:22:46PM +0100, BJ?rn Lindqvist wrote:
http://phd.pp.ru/Software/dotfiles/init.py.html See class _Exit. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.

This goes against the idea of keeping the language small. Believe me, it's been discussed to death, and the behavior you see now is the solid outcome of that discussion. On Feb 20, 2008 7:22 AM, BJörn Lindqvist <bjourne@gmail.com> wrote:
-- --Guido van Rossum (home page: http://www.python.org/~guido/)

This has been discussed to death several times before. I remember the rationale against doing something different to have various reasons. No one likes adding statements, for one thing (we have a tendency to move things out of keyword-space, not into it). Another solution was to define an ExitType with __str__ defined to raise SystemExit, but then what happens if you just do something to dump a bunch of objects? In other words: a side effect exiting is dangerous. As far as an actual statement, I'd definitely be -1 with a single exception. Would it be possible to define exit as an interpreter command, so long as the name 'exit' is not bound to anything but the exit str? In other words, it would only actually exit when you are in the interpreter, not when executing scripts or modules. On Feb 20, 2008, at 10:22 AM, BJörn Lindqvist wrote:

On Wed, Feb 20, 2008 at 4:51 PM, Calvin Spealman <ironfroggy@socialserve.com> wrote:
This has been discussed to death several times before. I remember the rationale against doing something different to have various reasons.
I haven't seem the statement idea discussed before.
No one likes adding statements, for one thing (we have a tendency to move things out of keyword-space, not into it).
What would the disadvantages of adding exit as a statement be? Would it make Python worse? Is there any other non-magical and straightforward solution to make exit to "do what I mean"? -- mvh Björn

On Feb 20, 2008 11:45 AM, BJörn Lindqvist <bjourne@gmail.com> wrote:
I hear you.. I keep typing exit_now_you_stupid_excuse_of_an_interpreter but it doesn't do what I mean! Seriously, pressing Ctrl-D/Ctrl-Z is not that much of a trouble to justify the bandwidth used for this thread. George

BJörn Lindqvist wrote:
We are trying hard to reduce the amount of statements and builtins. exit as a statement isn't worth the extra code. There are already plenty of ways to exit an interpreter process: sys.exit() os._exit() raise SystemExit exit() (interactive prompt) CTRL+Z or CTRL+D (interactive prompt) Christian

On Wed, Feb 20, 2008, BJ?rn Lindqvist wrote:
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.
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). -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ "All problems in computer science can be solved by another level of indirection." --Butler Lampson

Aahz wrote:
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.
Christian

On Wed, Feb 20, 2008 at 04:22:46PM +0100, BJ?rn Lindqvist wrote:
http://phd.pp.ru/Software/dotfiles/init.py.html See class _Exit. Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
participants (7)
-
Aahz
-
BJörn Lindqvist
-
Calvin Spealman
-
Christian Heimes
-
George Sakkis
-
Guido van Rossum
-
Oleg Broytmann