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/062176.html below:

[Python-Dev] quit() on the prompt

[Python-Dev] quit() on the prompt [Python-Dev] quit() on the promptGeorg Brandl g.brandl at gmx.net
Wed Mar 8 12:10:40 CET 2006
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 change I would suggest is the string used in repr.
> 
> Some of the objections to the current behavior boil down to
> "If it knows what I mean, why didn't it do it?"  We probably
> can't explain first-class callables in a short message, but
> we could emphasize that it has to be *call*ed.  Perhaps
> 
>          def __repr__(self):
>              return 'Calling %s() will exit python' % self.name

+1.

I also think that the old way should still be mentioned, as it is much
shorter to type.

Georg

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