[issue9362] Make exit/quit hint more novice friendly
New submission from Alexander Belopolsky
Ron Adam
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.
----------
nosy: +ron_adam
_______________________________________
Python tracker
Mark Lawrence
quit Use quit() or Ctrl-Z plus Return to exit exit Use exit() or Ctrl-Z plus Return to exit
----------
nosy: +BreamoreBoy
_______________________________________
Python tracker
Alexander Belopolsky
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.
----------
_______________________________________
Python tracker
Alexander Belopolsky
Alexander Belopolsky
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.
----------
_______________________________________
Python tracker
Alexander Belopolsky
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.
----------
_______________________________________
Python tracker
anatoly techtonik
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.
----------
_______________________________________
Python tracker
Michael Foord
Mark Lawrence
Alexander Belopolsky
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. :-)
----------
_______________________________________
Python tracker
Mark Lawrence
Alexander Belopolsky
Mark Lawrence
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.
----------
_______________________________________
Python tracker
anatoly techtonik
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.
----------
_______________________________________
Python tracker
Brian Curtin
^D File "<stdin>", line 1 ♦ ^ SyntaxError: invalid syntax
----------
nosy: +brian.curtin
_______________________________________
Python tracker
anatoly techtonik
C:\~env\Python26>
}}}
----------
_______________________________________
Python tracker
Brian Curtin
anatoly techtonik
Alexander Belopolsky
Why not to ship it in Python by default?
Because it is under GPL?
----------
nosy: +Alexander.Belopolsky
_______________________________________
Python tracker
anatoly techtonik
Why not to ship it in Python by default?
Because it is under GPL?
pyreadline is under BSD.
----------
_______________________________________
Python tracker
Changes by Brian Curtin
Mark Lawrence
^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.
----------
_______________________________________
Python tracker
anatoly techtonik
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.
----------
_______________________________________
Python tracker
Tim Golden
Westley Martínez
On Windows, Ctrl-D is replaced with Ctrl-Z.
----------
nosy: +anikom15
_______________________________________
Python tracker
Jeff Ramnani
Changes by Brian Curtin
participants (10)
-
Alexander Belopolsky
-
anatoly techtonik
-
anatoly techtonik
-
Brian Curtin
-
Jeff Ramnani
-
Mark Lawrence
-
Michael Foord
-
Ron Adam
-
Tim Golden
-
Westley Martínez