This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Make exit/quit hint more novice friendly
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.2
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Alexander.Belopolsky, BreamoreBoy, belopolsky, docs@python, jramnani, michael.foord, ron_adam, techtonik, tim.golden, westley.martinez
Priority: normal Keywords: easy

Created on 2010-07-23 19:24 by belopolsky, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (26)
msg111374 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-23 19:24
This bikeshed have been repainted several times already, but here is a true story.

Cast:

Me = myself
Novice = a 14-year-old boy
Laptop = a MacBook Air

Novice: How do i exit [from python prompt]?
Me: What's your best guess?
Novice: [typing] exit [pressing Enter]
Laptop: Use exit() or Ctrl-D (i.e. EOF) to exit
Novice: [typing] Ctrl...
Me: OMG, you don't know what Ctrl-D means?  Look for the Ctrl key.
Novice: There is no such key.
    --- curtains ---

I suggest changing

Use exit() or Ctrl-D (i.e. EOF) to exit

 to 

Type exit() or quit() and press the Enter key to exit

  or

Type exit() or quit() and press Enter to exit

 or just

Use exit() to exit

My theory is that someone who knows what EOF is, will probably already know how to exit from common terminal oriented programs and Ctrl-D is not universally bound to EOF.

TOOWTDI: two ways to exit is more than enough to teach a novice.
msg111427 - (view) Author: Ron Adam (ron_adam) * Date: 2010-07-24 05:45
I agree it could be improved a bit.

A little experimenting comes up with the following inconsistencies.

>>> quit
Use quit() or Ctrl-D (i.e. EOF) to exit
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit

help(exit) and help(quit) is not helpful. It instead shows the Quitter class in site.py with no doc strings.

exit() and quit() are both equivalent to sys.exit() and both except an exit code or message.


I think your third choice is good.

Type exit() or quit() and press Enter to exit

Advance users can still use Cntl-D.

Add a topics entry for help('EXIT') which can explain exiting the console in more detail and include the Ctrl-D short cut. help('QUIT') can point to the same topics info used for 'EXIT'.

Then add a doc string the the Quitter class that says to use help('EXIT') or help('QUIT') to get help for exit and quit.  


On another note: I've sometimes wanted quit() to exit from a running script to the python console so I can do a little value checking.  And for exit() to exit both the program and the console. But I think it may be too lake to make that particular change.
msg111455 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-24 11:26
I assume that this is on *nix boxes, on Windows it's:-

>>> quit
Use quit() or Ctrl-Z plus Return to exit
>>> exit
Use exit() or Ctrl-Z plus Return to exit
msg111483 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-24 14:32
> I assume that this is on *nix boxes

It's a bit of a stretch to call OSX unix, but yes:

>> Laptop = a MacBook Air

If you have not seen one of these, the control key is marked "control" on its keyboard.
msg111484 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-24 14:37
Now, as I look at it, the windows message is probably even worse.  What is "plus"?  Is "Ctrl-Z" control *minus* z?

For a novice, you really have to say: press Ctrl and Z keys together and then press Return or Enter key.  Of course this longer phrase is not appropriate for the exit hint.
msg111487 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-24 14:49
> On another note: I've sometimes wanted quit() to exit from a running
> script to the python console so I can do a little value checking.

This is what -i command line switch or PYTHONINSPECT environment variable is for.

See python -h output.
msg111618 - (view) Author: anatoly techtonik (techtonik) Date: 2010-07-26 13:48
On Fri, Jul 23, 2010 at 10:24 PM, Alexander Belopolsky
<report@bugs.python.org> wrote:
> I suggest changing
>
> Use exit() or Ctrl-D (i.e. EOF) to exit
>
>  to
>
> Type exit() or quit() and press the Enter key to exit

Type exit() or press Ctrl-D to exit.
msg111619 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-07-26 13:53
+1 to improving the message and improving the help message too.
msg111625 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-26 14:32
On Mon, Jul 26, 2010 at 9:48 AM, anatoly techtonik
<report@bugs.python.org> wrote:
..
> Type exit() or press Ctrl-D to exit.

Anatoly,

I think you missed the point of the story that I posted.  The young
user, who was not completely new to computers, by the way, was not
familiar with "Ctrl"  abbreviation and there was no key marked that
way on his keyboard.
msg111627 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-26 14:50
1) I'm with Michael on this one.
2) Python is not responsible for dotting every i and crossing every t for a computer novice.  What would the novice make of my HP keyboard which doesn't have keys marked RETURN or BS, they both have symbols.  There isn't an ANY key on the keyboard either! :)
msg111636 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-26 15:32
On Mon, Jul 26, 2010 at 10:50 AM, Mark Lawrence <report@bugs.python.org> wrote:
..
> 2) Python is not responsible for dotting every i and crossing every t for a computer novice.

Yes, but it is not responsible for teaching a novice more than one way
to exit the interpreter right off the bat.    Note that the
Ctrl-D/Ctrl-Z recommendation has a long history from the time when
there was no exit/quit object defined in the default site.py and the
alternative to the magic key-press was an unwieldy raise SystemExit.

Note the following bug report from IDLEfork project:

http://sourceforge.net/tracker/?func=detail&atid=109579&aid=693333&group_id=9579

Apparently, some IDEs may want to rebind Ctrl-Z form EOF to (in this
case) undo action.  This is quite reasonable, but it makes the exit
hint misleading.  There are many reasons outside of python control for
EOF to be bound to the keys other than Ctrl-Z/D.   The current logic
in site.py that makes a choice based on the filepath separator
character is quite fragile:

    if os.sep == ':':
        eof = 'Cmd-Q'
    elif os.sep == '\\':
        eof = 'Ctrl-Z plus Return'
    else:
        eof = 'Ctrl-D (i.e. EOF)'

>  What would the novice make of my HP keyboard which doesn't have keys marked RETURN or BS,
> they both have symbols.

There is very little you can do at the command prompt without knowing
where your enter key is.  In fact, you will not even see the hint in
question if you don't press enter after typing exit.   On the other
hand, you can get quite far without using control key and if it is
marked "control" or a national equivalent on your keyboard, you may
not know the ctrl abbreviation for quite some time.  Note that my last
alternative, "Use exit() to exit" or "Enter exit() to exit"  does not
require knowing how the enter key is called.  The user just need to
know the means of entering commands and he or she must know this
before seeing the exit hint anyways.

>  There isn't an ANY key on the keyboard either! :)

Right.  And computer industry would save loads of money in support
calls if they instructed users to press the space bar instead. :-)
msg111638 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-26 15:45
Could we (easily) add a third line at startup that says how to quit?
msg111639 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-26 16:03
On Mon, Jul 26, 2010 at 11:45 AM, Mark Lawrence <report@bugs.python.org> wrote:
>
> Mark Lawrence <breamoreboy@yahoo.co.uk> added the comment:
>
> Could we (easily) add a third line at startup that says how to quit?

+1

Alternatively, we can add the second line to help output:

Type help() for interactive help, or help(object) for help about object.
Type exit() to exit python.
msg111650 - (view) Author: anatoly techtonik (techtonik) Date: 2010-07-26 17:35
On Mon, Jul 26, 2010 at 5:32 PM, Alexander Belopolsky
<report@bugs.python.org> wrote:
>
> I think you missed the point of the story that I posted.  The young
> user, who was not completely new to computers, by the way, was not
> familiar with "Ctrl"  abbreviation and there was no key marked that
> way on his keyboard.

The stuff that should be explained once in a lifetime to every newborn
software engineer will waste million of braincycles over the world
every time the stuff is read. You need to consider changing the school
program in your region to add practical computer lessons where
chindren are explained all questions they have about computers.
--
anatoly t.
msg111653 - (view) Author: anatoly techtonik (techtonik) Date: 2010-07-26 17:42
On Mon, Jul 26, 2010 at 7:03 PM, Alexander Belopolsky
<report@bugs.python.org> wrote:
>>
>> Could we (easily) add a third line at startup that says how to quit?
>
> +1

+1

- Type "help", "copyright", "credits" or "license" for more information.
+ Type "help", "copyright", "credits" or "license" for more
information, "exit" to quit.

> Alternatively, we can add the second line to help output:
>
> Type help() for interactive help, or help(object) for help about object.
> Type exit() to exit python.

-0.5 (no beer from me)

BTW, Ctrl-D works on Windows also. No need to maintain system-specific
Ctrl-Z shortcut.
msg111655 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-07-26 17:47
Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
  File "<stdin>", line 1
    ♦
    ^
SyntaxError: invalid syntax
msg111661 - (view) Author: anatoly techtonik (techtonik) Date: 2010-07-26 19:04
Something is broken in your 3.1.2 - this is Ctrl-D for me.

{{{
Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\~env\Python26>python
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

C:\~env\Python26>
}}}
msg111662 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-07-26 19:18
Do you have pyreadline installed? If so, that is causing it. If not, it's something else as Ctrl-D is not an EOF character on Windows.
msg111665 - (view) Author: anatoly techtonik (techtonik) Date: 2010-07-26 20:32
It appears that `import pyreadline` goes ok. It appears that this lib
is used for unification of console incompatibilities between platform.
Why not to ship it in Python by default?
msg111666 - (view) Author: Alexander Belopolsky (Alexander.Belopolsky) Date: 2010-07-26 20:38
On Jul 26, 2010, at 4:32 PM, anatoly techtonik  
<report@bugs.python.org> wrote:
>
> Why not to ship it in Python by default?
>

Because it is under GPL?
msg111667 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-07-26 20:48
c:\py3k\Lib>py32
Python 3.2a0 (py3k:83057M, Jul 22 2010, 15:20:27) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
  File "<stdin>", line 1
    ♦
    ^
SyntaxError: invalid syntax
[49008 refs]
>>>

This to me is getting stupid.  Let's make a decision and move on, there are far more pressing issues that need attention.
msg111776 - (view) Author: anatoly techtonik (techtonik) Date: 2010-07-28 08:45
>> Why not to ship it in Python by default?
>
> Because it is under GPL?

pyreadline is under BSD.
msg111777 - (view) Author: anatoly techtonik (techtonik) Date: 2010-07-28 08:50
On Mon, Jul 26, 2010 at 11:48 PM, Mark Lawrence <report@bugs.python.org> wrote:
>
> This to me is getting stupid.  Let's make a decision and move on, there are far more pressing issues that need attention.

Do you think that getting `readline` module to run on Windows is stupid?
I think it is stupid that IPython ships pyreadline to fill the gap on
Windows - it should be done in Python distribution.
msg111778 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2010-07-28 08:53
Not necessarily; pyreadline takes over from the standard console
functionality on Windows in order to emulate a more Unix-ish
approach. I prefer the Windows default.

There's nothing to stop someone downloading and installing
pyreadline as a third-party package on Windows
msg127565 - (view) Author: Westley Martínez (westley.martinez) * Date: 2011-01-31 01:40
This is annoying. Every beginner's Python tutorial I've read made it very clear how to exactly exit the interactive shell. Ctrl has been in use for years. Changing it for novices' sake is ridiculous. Do we need to expand every abbreviation? Python will turn into Java (joke). As for Ctrl-D or Ctrl-Z, I think it's fine the way it is. Python is used for scripting, and Windows administators are familiar with Ctrl-Z for EOF but may not necessarily be familiar with Ctrl-D.

Ok, in final, I think the only thing that might be changed is the shell's opening message:

Python 3.1.3 (r313:86834, Jan 28 2011, 20:00:55) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Type "exit()", "quit()" or Ctrl-D (i.e. EOF) to exit.
>>> 

On Windows, Ctrl-D is replaced with Ctrl-Z.
msg130946 - (view) Author: Jeff Ramnani (jramnani) * Date: 2011-03-15 02:22
I've checked Lib/site.py and it tells the user to use 'Ctrl-Z' to exit the prompt when they are running Windows.

Perhaps this means we can close the ticket, since discussion on this issue seems to have dissipated?
History
Date User Action Args
2022-04-11 14:57:04adminsetgithub: 53608
2011-03-15 02:22:54brian.curtinsetstatus: open -> closed
nosy: belopolsky, techtonik, ron_adam, tim.golden, michael.foord, Alexander.Belopolsky, docs@python, BreamoreBoy, westley.martinez, jramnani
resolution: rejected
stage: resolved
2011-03-15 02:22:22jramnanisetnosy: + jramnani
messages: + msg130946
2011-01-31 01:40:24westley.martinezsetnosy: + westley.martinez
messages: + msg127565
2010-07-28 08:53:36tim.goldensetnosy: + tim.golden
messages: + msg111778
2010-07-28 08:50:55techtoniksetmessages: + msg111777
2010-07-28 08:45:26techtoniksetmessages: + msg111776
2010-07-26 20:48:43BreamoreBoysetmessages: + msg111667
2010-07-26 20:39:18brian.curtinsetnosy: - brian.curtin
2010-07-26 20:38:36Alexander.Belopolskysetnosy: + Alexander.Belopolsky
messages: + msg111666
2010-07-26 20:32:12techtoniksetmessages: + msg111665
2010-07-26 19:18:33brian.curtinsetmessages: + msg111662
2010-07-26 19:04:39techtoniksetmessages: + msg111661
2010-07-26 17:47:15brian.curtinsetnosy: + brian.curtin
messages: + msg111655
2010-07-26 17:42:21techtoniksetmessages: + msg111653
2010-07-26 17:35:58techtoniksetmessages: + msg111650
2010-07-26 16:03:05belopolskysetmessages: + msg111639
2010-07-26 15:45:52BreamoreBoysetmessages: + msg111638
2010-07-26 15:32:19belopolskysetmessages: + msg111636
2010-07-26 14:50:40BreamoreBoysetmessages: + msg111627
2010-07-26 14:32:33belopolskysetmessages: + msg111625
2010-07-26 13:53:45michael.foordsetnosy: + michael.foord
messages: + msg111619
2010-07-26 13:48:50techtoniksetnosy: + techtonik
messages: + msg111618
2010-07-24 14:49:37belopolskysetmessages: + msg111487
2010-07-24 14:37:22belopolskysetmessages: + msg111484
2010-07-24 14:32:23belopolskysetmessages: + msg111483
2010-07-24 11:26:39BreamoreBoysetnosy: + BreamoreBoy
messages: + msg111455
2010-07-24 05:45:34ron_adamsetnosy: + ron_adam
messages: + msg111427
2010-07-23 19:24:00belopolskycreate