java 5 could like python?

Bengt Richter bokr at
Sat Jan 15 18:05:27 EST 2005

On Sat, 15 Jan 2005 15:08:05 GMT, claird at (Cameron Laird) wrote:

>In article <mailman.568.1105544231.22381.python-list at>,
>vegetax  <vegeta.z at> wrote:
>			.
>			.
>			.
>>For example if i remember a function i want ie:get attribute, i dont
>>remember if the module implementer coded it as
>>getAttribute,GetAttribute,get_attribute, then i have to go and check the
>>doc, every time,which is a waste of time.
>			.
>			.
>			.
>Are you comfortable using the base interpreter's built-in 
>interactive facilities, such as help()?  I strongly urge 
>you to exercise these for at least a few minutes.

This triggers a thought: Some are more passive about exploring than others,
and think there's nothing to be seen except what's pointed at. Sad for them,
but they need help too. One hopes the tutorial stuff will reawaken natural
pleasure in finding out neat stuff. After all, they came to the right place :-)
But back to my point (it's coming ;-) [1] ...

 >>> help
 Type help() for interactive help, or help(object) for help about object.

Ok, will do ;-)

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

 class object
  |  The most base type

Taking the 'object' lesson a little too literally, perhaps ;-)

 >>> help(my_object)
 Traceback (most recent call last):
   File "<stdin>", line 1, in ?
 NameError: name 'my_object' is not defined

Ok, why wasn't I told to expect that in the help() intro?
Or that that the following might get me further info?

 >>> help('my_object')
 no Python documentation found for 'my_object'

[1] Ok, here's the idea that triggered this post:

What if help(something) didn't immediately give up with that last message?
If instead it looked for on the path, and invoked helpex(something) if found?
That way, people could easily experiment with site-specific help extensions. ISTR a shell in the
deep past sometime that would look for a custom extension before giving up with a parsing error,
so I'm not inventing anything new (unless I misremember ;-)

That's all. A simple hook could also do it, and could hook it on if desired. E.g.,

    def helpex(*a,**kw):
        return "helpex doesn't exist yet, but it was called with %r and %r ;-)" %(a, kw)

    help.helpex = helpex

You could get fancy and make that a property or properties of the base help,
and have it chain multiple hookings at front or back for priority etc.
Maybe we can invent a standard help extension methodology for temporary app stuff
as as well as quasi-permanent site-specific stuff. ...
just noodling variations on a theme ;-)

For reference:

 >>> help()

 Welcome to Python 2.4!  This is the online help utility.

 If this is your first time using Python, you should definitely check out
 the tutorial on the Internet at

 Enter the name of any module, keyword, or topic to get help on writing
 Python programs and using Python modules.  To quit this help utility and
 return to the interpreter, just type "quit".

 To get a list of available modules, keywords, or topics, type "modules",
 "keywords", or "topics".  Each module also comes with a one-line summary
 of what it does; to list the modules whose summaries contain a given word
 such as "spam", type "modules spam".

Bengt Richter

More information about the Python-list mailing list