[Python-Dev] quit() on the prompt

Guido van Rossum guido at python.org
Tue Mar 7 22:53:00 CET 2006


Works for me.

On 3/7/06, Ian Bicking <ianb at colorstudy.com> 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 everyone drifted off, too tired from the
> discussion to make a change.  I suppose it didn't help that the original
> proposal struck some people as too magic, while there were some more
> substantive problems brought up as well, and when you mix aesthetic with
> technical concerns everyone gets all distracted and worked up.  Anyway,
> I would like to re-propose one of the ideas that came up (originally
> from Ping?):
>
> 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 is not very magical, but I think is more helpful than the current
> behavior.  It does not satisfy the "just do what I said" argument for
> not requiring the call (quit() not quit), but eh -- I guess it seemed
> like everything that didn't require a call had some scary corner case
> where the interpreter would abruptly exit.
>
> --
> Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list