[Python-Dev] quit() on the prompt
Jim Jewett
jimjjewett at gmail.com
Wed Mar 8 01:07:22 CET 2006
More information about the Python-Dev mailing list
Wed Mar 8 01:07:22 CET 2006
- Previous message: [Python-Dev] quit() on the prompt
- Next message: [Python-Dev] quit() on the prompt
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
-jJ
- Previous message: [Python-Dev] quit() on the prompt
- Next message: [Python-Dev] quit() on the prompt
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list