classification
Title: [patch] Let users do help('@') and so on for confusing syntax constructs.
Type: enhancement Stage:
Components: Documentation Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: alsuren, georg.brandl, giampaolo.rodola
Priority: normal Keywords: patch

Created on 2008-12-24 17:37 by alsuren, last changed 2008-12-27 18:20 by georg.brandl. This issue is now closed.

Files
File name Uploaded Description Edit
add_symbol_help.diff alsuren, 2008-12-24 17:37 patch against pydoc.py from python 2.5.2-0ubuntu1
Messages (2)
msg78267 - (view) Author: David Laban (alsuren) Date: 2008-12-24 17:37
When I first came across decorators (about a year ago?), they confused
the hell out of me, and the syntax is completely google-proof, so I
ended up having to ask on irc.

One of the things that I tried was help('@') but that didn't work
either. This patch is to make that work, and also a lot of other
google-proof syntax constructs.

Notes on the patch
==================

I've tried to do it with as few changes/duplications as possible, but my
style is quite different from the rest of the module. I hereby donate my
code to whoever wants to commit it. Do what you want with it, and clean
it up however you want. I'm doing it for the n00bs.

The patch is against pydoc.py from python 2.5.2-0ubuntu1. If you want me
to create a patch against another version of python, send me an email.
Otherwise, apply it by hand: I've tried to make as few changes as
possible, so it shouldn't be too tricky.

Notes on other versions of Python
=================================
Python 3000 (and maybe 2.6? I've not checked) has the note:
    # CAUTION: if you change one of these dictionaries, be sure to adapt the
    #          list of needed labels in
Doc/tools/sphinxext/pyspecific.py and
    #          regenerate the pydoc_topics.py file by running
    #              make pydoc-topics
    #          in Doc/ and copying the output file into the Lib/ directory.
but all I'm doing is adding aliases, so you shouldn't need to rebuild
the docs just to get help() working. Note that I've not actually tested
this though.

To test, I did:
 python -c 'import pydoc ; help(":=")' | grep 'no Python documentation
found for .*'
which should print:
 no Python documentation found for ':='
and:
 python -c 'import pydoc ; [help(k) for k in pydoc.help.symbols]' | grep
-c 'no Python documentation found for .*'
which should print nothing.
msg78375 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-12-27 18:20
Thanks for the patch!

Applied with minor edits to the trunk as r67953.  I will backport to the
2.6 branch as well.
History
Date User Action Args
2008-12-27 18:20:43georg.brandlsetstatus: open -> closed
resolution: accepted
messages: + msg78375
2008-12-24 17:45:02giampaolo.rodolasetnosy: + giampaolo.rodola
2008-12-24 17:37:45alsurencreate