[Python-Dev] a quit that actually quits
Alex Martelli
aleaxit at gmail.com
Wed Dec 28 17:06:53 CET 2005
On Dec 28, 2005, at 3:24 AM, Michael Hudson wrote:
> skip at pobox.com writes:
>
>> Fredrik> a quit/exit command that actually quits, instead of
>> printing a
>> Fredrik> "you didn't say please!" message.
>>
>> I like Fredrik's idea more and more.
>
> The thing that bothers me about it is that the standard way you tell
> python to do something is "call a function" -- to me, a special case
> for exiting the interpreter seems out of proportion.
Just brainstorming, but -- maybe this means we should generalize the
idea? I.e., allow other cases in which "just mentioning X" means
"call function Y [with the following arguments]", at least at the
interactive prompt if not more generally. If /F's idea gets
implemented by binding to names 'exit' and 'quit' the result of some
factory-call with "function to be called" set to sys.exit and
"arguments for it" set to () [[as opposed to specialcasing checks of
last commandline for equality to 'exit' &c]] then the implementation
of the generalization would be no harder. I do find myself in
sessions in which I want to perform some action repeatedly, and
currently the least typing is 4 characters (x()<enter>) while this
would reduce it to two (iPython does allow such handy shortcuts, but
I'm often using plain interactive interpreters).
If this generalization means a complicated implementation, by all
means let's scrap it, but if implementation is roughly as easy, it
may be worth considering to avoid making a too-special "special
case" (or maybe not, but brainstorming means never having to say
you're sorry;-).
Alex
More information about the Python-Dev
mailing list