[Python-Dev] quit() on the prompt

Ian Bicking ianb at colorstudy.com
Wed Mar 8 00:31:01 CET 2006


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: ...
   >>> quit
   $

Or:

   >>> if raw_input('quit?') == 'yes':
   ...     quit

will that work?  Should it?  Functions are pretty predictable in 
comparison to these other options.  So, at least to me, quit() == KISS


-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org


More information about the Python-Dev mailing list