A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-March/062165.html below:

[Python-Dev] quit() on the prompt

[Python-Dev] quit() on the prompt [Python-Dev] quit() on the promptThomas Wouters thomas at python.org
Wed Mar 8 00:37:47 CET 2006
On 3/8/06, Brett Cannon <brett at python.org> wrote:
>
> On 3/7/06, Ian Bicking <ianb at colorstudy.com> 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')
>
> +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 the
wording could use some work):

>>> raise SystemExit("quit() called")
quit() called

(At least, I consider that a benefit :-)
--
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060308/a3808aba/attachment.html 
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4