Issue 925628: help does not help with imported objects (original) (raw)

Created on 2004-03-29 21:34 by jimjjewett, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg20376 - (view) Author: Jim Jewett (jimjjewett) Date: 2004-03-29 21:34
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.
msg20377 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2004-03-30 17:50
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.
msg20378 - (view) Author: Jim Jewett (jimjjewett) Date: 2004-04-08 17:58
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))
msg20379 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2004-04-09 00:39
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.
msg20380 - (view) Author: Jim Jewett (jimjjewett) Date: 2004-04-13 18:15
Logged In: YES user_id=764593 Patch 934356 changes help(module) to document objects in __all__, if __all__ is defined.
msg20381 - (view) Author: Johannes Gijsbers (jlgijsbers) * (Python triager) Date: 2004-08-30 14:15
Logged In: YES user_id=469548 Fixed by applying patch #934356.
History
Date User Action Args
2022-04-11 14:56:03 admin set github: 40100
2004-03-29 21:34:09 jimjjewett create