[ python-Bugs-925628 ] help does not help with imported objects

SourceForge.net noreply at sourceforge.net
Mon Aug 30 16:15:34 CEST 2004


Bugs item #925628, was opened at 2004-03-29 23:34
Message generated for change (Comment added) made by jlgijsbers
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=925628&group_id=5470

>Category: Python Library
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 2
Submitted By: Jim Jewett (jimjjewett)
>Assigned to: Johannes Gijsbers (jlgijsbers)
Summary: help does not help with imported objects

Initial Comment:
help(re) just says it is a wrapper for sre.  To get actually 
help, you need to explicitly import sre as well.

re.__doc__ = re.__doc__ + sre.__doc__ helps, but still 
does not list information on classes or exported functions. 

Specific requests, such as 

help(re.subn) 

do work;  it is only the module-level help that is lacking 
when a module reexports imported objects.

----------------------------------------------------------------------

>Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-08-30 16:15

Message:
Logged In: YES 
user_id=469548

Fixed by applying patch #934356.

----------------------------------------------------------------------

Comment By: Jim Jewett (jimjjewett)
Date: 2004-04-13 20:15

Message:
Logged In: YES 
user_id=764593

Patch 934356 changes help(module) to document objects in 
__all__, if __all__ is defined.

----------------------------------------------------------------------

Comment By: Terry J. Reedy (tjreedy)
Date: 2004-04-09 02:39

Message:
Logged In: YES 
user_id=593130

My non-expert suggestions:

1. For this item, suggest a short addition to re.__doc__, 
something like I suggested before, and reclassify this to 
category documentation.  Doc gurus should then get an 
email.  Or just close.

2. For pydoc, maybe submit a separate patch or RFE 
(requiest for enhancement).  Or, if currently behavior is 
arguably at odds with either lib ref or its doc string, a bug.

----------------------------------------------------------------------

Comment By: Jim Jewett (jimjjewett)
Date: 2004-04-08 19:58

Message:
Logged In: YES 
user_id=764593

I've dug a bit deeper.  The problem seems to be that when 
pydoc is documenting a module, it explicitly ignores classes 
and functions that are defined outside that module.  (For data, 
it does not.)  If the module itself reexports these classes, they 
should be included in help.

Example from  class TextDoc.docmodule:

        classes = []
        for key, value in inspect.getmembers(object, inspect.
isclass):
            if (inspect.getmodule(value) or object) is object:
                if visiblename(key):
                    classes.append((key, value))
        funcs = []
        for key, value in inspect.getmembers(object, inspect.
isroutine):
            if inspect.isbuiltin(value) or inspect.getmodule(value) 
is object:
                if visiblename(key):
                    funcs.append((key, value))


----------------------------------------------------------------------

Comment By: Terry J. Reedy (tjreedy)
Date: 2004-03-30 19:50

Message:
Logged In: YES 
user_id=593130

I am not sure a see a bug here (as opposed to enhancement 
request).  re.__all__ and dir(re) list exported names.  help
(re.engine) gets the multipage doc from the wrapped engine 
without importing it.  The re doc string could be enhanced by 
adding a FOR MORE section that says so.

Automatically adding sre would have been wrong when there 
were multiple engines in the distribution.  Not sure if are or 
will be in 2.4, but there could be in the future again.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=925628&group_id=5470


More information about the Python-bugs-list mailing list