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.
|