Re: [Python-Dev] quit() on the prompt

2006-03-09 Thread Georg Brandl
Guido van Rossum wrote: > We seem to have a consensus. Is anybody working on a patch yet? http://python.org/sf/1446372 Georg ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.

Re: [Python-Dev] quit() on the prompt

2006-03-08 Thread Guido van Rossum
We seem to have a consensus. Is anybody working on a patch yet? -- --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mai

Re: [Python-Dev] quit() on the prompt

2006-03-08 Thread Greg Ewing
Oleg Broytmann wrote: >IDEs. Edit a code in an editor, run python -i script.py, investigate the > environment, return to the editor, get error message. An IDE is likely to want to catch SystemExits in the debugged script and handle them specially anyway. -- Greg Ewing, Computer Science Dept

Re: [Python-Dev] quit() on the prompt

2006-03-08 Thread Josiah Carlson
Ian Bicking <[EMAIL PROTECTED]> wrote: > > Neil Schemenauer wrote: > >>Bad idea, as several pointed out -- quit() should return a 0 exit > >>to the shell. > > > > > > I like the idea of making "quit" callable. One small concern I have > > is that people will use it in scripts to exit (rather t

Re: [Python-Dev] quit() on the prompt

2006-03-08 Thread Ian Bicking
Neil Schemenauer wrote: >>Bad idea, as several pointed out -- quit() should return a 0 exit >>to the shell. > > > I like the idea of making "quit" callable. One small concern I have > is that people will use it in scripts to exit (rather than one of > the other existing ways to exit). OTOH, may

Re: [Python-Dev] quit() on the prompt

2006-03-08 Thread Neil Schemenauer
Guido van Rossum <[EMAIL PROTECTED]> wrote: > Bad idea, as several pointed out -- quit() should return a 0 exit > to the shell. I like the idea of making "quit" callable. One small concern I have is that people will use it in scripts to exit (rather than one of the other existing ways to exit).

Re: [Python-Dev] quit() on the prompt

2006-03-08 Thread Guido van Rossum
On 3/7/06, Thomas Wouters <[EMAIL PROTECTED]> wrote: > +1 from me. Only change I would make is pass an argument to > SystemExit() such as "%s() called", although the chances of this > exception being caught is very slim. > > > Raising SystemExit("quit() called") has an additional benefit (although

Re: [Python-Dev] quit() on the prompt

2006-03-08 Thread Oleg Broytmann
On Wed, Mar 08, 2006 at 12:39:51PM +, Steve Holden wrote: > Oleg Broytmann wrote: > raise SystemExit("quit() called") > > > > quit() called > > Error! > > > I should imagine the use cases for running an interactive Python shell > as a part of a script are fairly few and far between, thou

Re: [Python-Dev] quit() on the prompt

2006-03-08 Thread Steve Holden
Oleg Broytmann wrote: > On Wed, Mar 08, 2006 at 12:37:47AM +0100, Thomas Wouters wrote: > >>Raising SystemExit("quit() called") has an additional benefit (although the >>wording could use some work): >> >> >raise SystemExit("quit() called") >> >>quit() called >> >>(At least, I consider that a

Re: [Python-Dev] quit() on the prompt

2006-03-08 Thread Oleg Broytmann
On Wed, Mar 08, 2006 at 12:37:47AM +0100, Thomas Wouters wrote: > Raising SystemExit("quit() called") has an additional benefit (although the > wording could use some work): > > >>> raise SystemExit("quit() called") > quit() called > > (At least, I consider that a benefit :-) It has a bad sid

Re: [Python-Dev] quit() on the prompt

2006-03-08 Thread Georg Brandl
Jim Jewett wrote: > Ian reproposed: > > class Quitter(object): > def __init__(self, name): > self.name = name > def __repr__(self): > return 'Use %s() to exit' % self.name > def __call__(self): > raise SystemExit() > > The one

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Thomas Wouters
On 3/8/06, Brett Cannon <[EMAIL PROTECTED]> wrote: On 3/7/06, Ian Bicking <[EMAIL PROTECTED]> wrote:> class Quitter(object):>  def __init__(self, name):>  self.name = name>  def __repr__(self):>  return 'Use %s() to exit' % self.name>  def __call__(self):>  rais

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Brett Cannon
On 3/7/06, Ian Bicking <[EMAIL PROTECTED]> wrote: > Frederick suggested a change to quit/exit a while ago, so it wasn't just > a string with slight instructional purpose, but actually useful. The > discussion was surprisingly involved, despite the change really trully > not being that big. And ev

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Ian Bicking
BJörn Lindqvist wrote: > do { > cmd = readline() > do_stuff_with_cmd(cmd); > } while (!strcmp(cmd, "quit")); > printf("Bye!"); > exit(0); > > KISS? I believe there were concerns that rebinding quit would cause strange behavior. E.g.: >>> quit = False >>> while not quit: ... >>

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Crutcher Dunnavant
I am probably the biggest proponent of magic variables, but this just won't work. First, commands and lines are not the same thing, so: print \ exit breaks your propossal. Second, quit and exit are bindable variables, and you need to be sure that they still mean _quit_, and not something else.

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread BJörn Lindqvist
do { cmd = readline() do_stuff_with_cmd(cmd); } while (!strcmp(cmd, "quit")); printf("Bye!"); exit(0); KISS? -- mvh Björn ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://m

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Nick Coghlan
Ian Bicking wrote: > class Quitter(object): > def __init__(self, name): > self.name = name > def __repr__(self): > return 'Use %s() to exit' % self.name > def __call__(self): > raise SystemExit() > quit = Quitter('quit') > exit = Quitter('exit') > > This i

Re: [Python-Dev] quit() on the prompt

2006-03-07 Thread Guido van Rossum
Works for me. On 3/7/06, Ian Bicking <[EMAIL PROTECTED]> wrote: > Frederick suggested a change to quit/exit a while ago, so it wasn't just > a string with slight instructional purpose, but actually useful. The > discussion was surprisingly involved, despite the change really trully > not being th