From 3d050ddf195a4473051f82e47b969c9b196dfa09 Mon Sep 17 00:00:00 2001 From: R David Murray Date: Sat, 19 Apr 2014 12:59:30 -0400 Subject: [PATCH] #9364: Improve the text printed by help(pydoc) and help(help). --- Lib/_sitebuiltins.py | 6 +++++- Lib/pydoc.py | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Lib/_sitebuiltins.py b/Lib/_sitebuiltins.py index 1f21358e268..c29cf4bf8fe 100644 --- a/Lib/_sitebuiltins.py +++ b/Lib/_sitebuiltins.py @@ -87,8 +87,12 @@ def __call__(self): class _Helper(object): """Define the builtin 'help'. - This is a wrapper around pydoc.help (with a twist). + This is a wrapper around pydoc.help that provides a helpful message + when 'help' is typed at the Python interactive prompt. + + Calling help() at the Python prompt starts an interactive help session. + Calling help(thing) prints help for the python object 'thing'. """ def __repr__(self): diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 006212b32e5..5f128320d25 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1,8 +1,9 @@ #!/usr/bin/env python3 """Generate Python documentation in HTML or text for interactive use. -In the Python interpreter, do "from pydoc import help" to provide -help. Calling help(thing) on a Python object documents the object. +At the Python interactive prompt, calling help(thing) on a Python object +documents the object, and calling help() starts up an interactive +help session. Or, at the shell command line outside of Python: @@ -1865,7 +1866,7 @@ def help(self, request): def intro(self): self.output.write(''' -Welcome to Python %s! This is the interactive help utility. +Welcome to Python %s's help utility! If this is your first time using Python, you should definitely check out the tutorial on the Internet at http://docs.python.org/%s/tutorial/.