[Python-Dev] a quit that actually quits

Nick Coghlan ncoghlan at gmail.com
Fri Dec 30 04:05:26 CET 2005


Samuele Pedroni wrote:
> Michael Chermside wrote:
>> The F-bot writes:
>>
>>> in reality, some things are carefully thought out and craftily im-
>>> plemented, some things are engineering tradeoffs made at a certain time,
>>> and some things are just accidents -- but python-dev will happily defend
>>> the current solution with the same energy, no matter what it is.
>>
>> +1 QOTF.
>>
>> Seriously... I've seen this behavior also, but I haven't ever thought
>> about it as clearly as Fredrik does here. When we go to answer questions
>> we ought to pause briefly first and decide which of these categories
>> applies to a given piece of behavior. I think users will be understanding
>> if we're honest about what are the accidents -- every language or
>> software package has some, and just because it's an accident does NOT
>> mean we should "fix" it.

Most of the times I've asked questions along these lines I've gotten 
well-considered answers (usually because something I thought was a deliberate 
design decision on Guido's part turned out to simply be an accident of the way 
it happened to be implemented in CPython).

> it's indeed a matter of trade-offs. Converting NameErrors into commands
> doesn't look like a good trade off in terms of expectations management
> and understandable behavior. Ka-Ping Yee ExitHatch still seem a 
> reasonable improvement. Fernando Perez considerations about Python
> vs. "commands" and prefixing and extra-linguistic extensions seem
> also on spot. It's not a matter of defending the status quo, more about
> what kind of price is reasonable for DWIM.

I think Fredrik has made an excellent case for promoting the quit & exit 
interpreter-only builtins to be proper callables.

Hell, we even have that capability for the callable that displays the 
*license* text. . . surely quitting the interpreter is far more important than 
being able to display the license text, but the support for the latter is 
significantly better:


Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Py> exit
'Use Ctrl-Z plus Return to exit.'
Py> quit
'Use Ctrl-Z plus Return to exit.'
Py> license
Type license() to see the full license text
Py> type(license)
<class 'site._Printer'>

Counting blank lines, 60 lines of site.py are devoted to getting copyright, 
credit and license to work right, 16 to getting help to work, and only 12 to 
setting quit and exit to the 'right' strings - and due to modules like 
readline for Windows and differences in the way interpreters buffer the line 
input, the exit string for Windows is not always correct.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list