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: help(x) for keywords too
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: JosephArmbruster, georg.brandl, jimjjewett, rhettinger, theller
Priority: normal Keywords:

Created on 2006-10-06 15:06 by jimjjewett, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (9)
msg54917 - (view) Author: Jim Jewett (jimjjewett) Date: 2006-10-06 15:06
At the interactive prompt, help(object) is very useful.

It would be nice if it also worked on keywords.

"""
>>> help(object)
Help on class object in module __builtin__:

class object
 |  The most base type
"""

vs 

"""
>>> help(with)
SyntaxError: invalid syntax
"""

At the moment, the workaround is to open the 
documentation, pick a document that doesn't seem quite 
right (language reference?), go to the index, and look 
for the keyword.
msg54918 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-10-06 15:59
Logged In: YES 
user_id=849994

Doesn't help("if") work for you?
msg54919 - (view) Author: Jim Jewett (jimjjewett) Date: 2006-10-06 16:26
Logged In: YES 
user_id=764593

No, it doesn't -- but putting the keyword in quotes does at 
least change the error message to saying that topic and 
keyword documentation is not available because the Python 
HTML documentation files could not be found.  

I'm using Windows XP, the 2.4 and 2.5 binaries from 
python.org, if I changed anything it was just the install 
directory to be Python2.5 (or 2.4 for 2.4))

The documentation (as a chm file) is found by the F1 key.  
Is this likely to be a windows build issue?
msg54920 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2006-10-06 19:25
Logged In: YES 
user_id=11105

> Is this likely to be a windows build issue?

No.  pydoc cannot use the .chm file.  Either you should
download the HTML files yourself, or you can compile the
.chm file in a windows command shell (note that the
decompilation runs in the background, and has no user
interface):

C:\Python24\Doc>hh -decompile . Python24.chm

C:\Python24\Doc>dir *.chm
 Datenträger in Laufwerk C: ist ...
 Volumeseriennummer: ...

 Verzeichnis von C:\Python24\Doc

06.10.2006  21:23             3.732 about.html
06.10.2006  21:23             8.689 acks.html
06.10.2006  21:23             4.445 index.html
06.10.2006  21:23            35.525 modindex.html
               4 Datei(en)         52.391 Bytes
               0 Verzeichnis(se),  8.506.798.080 Bytes frei

C:\Python24\Doc>

The other HTML files are created in subdirectories, and
help("if") now works.
msg54921 - (view) Author: Jim Jewett (jimjjewett) Date: 2006-11-21 15:41
1600491 contains a doc patch, which is basically just adding Tom Heller's advice on *how* to build to the error message.
msg54922 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2006-11-27 18:13
Ideally, if help() doesn't find local HTML files, it should be smart enough to look on doc.python.org.    People who need help are not usually in a position to build their own help files.
msg54923 - (view) Author: Jim Jewett (jimjjewett) Date: 2006-11-27 18:23
Pointing to docs.python.org doesn't help if you don't have a current net connection.

In this case, the build instructions *are* the single line from Thomas:

C:\Python24\Doc>hh -decompile . Python25.chm

Since hh comes with windows, the barrier is fairly low.
msg59214 - (view) Author: Joseph Armbruster (JosephArmbruster) Date: 2008-01-04 04:37
This issue should probably be closed. Performing the decompile on the
command line as directed by the interpreter is as trivial as firing up
the interpreter itself.

It would make more sense to add an option to the installer that would
automagically perform the decompile of the docs via an option or
something at the users request.

Your Thoughts?
msg59311 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-05 19:33
1600491 was applied, so I'm closing this.
History
Date User Action Args
2022-04-11 14:56:20adminsetgithub: 44092
2008-01-05 19:33:57georg.brandlsetstatus: open -> closed
resolution: works for me
messages: + msg59311
2008-01-04 04:37:19JosephArmbrustersetnosy: + JosephArmbruster
messages: + msg59214
2006-10-06 15:06:40jimjjewettcreate