This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author david_abrahams
Recipients
Date 2002-03-09.02:30:30
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
If __all__ is set in a module, pydoc should only 
document those attributes, IMO. For example:


# foo.py
__all__ = [ 'hello' ]
from sys import *

def hello():
    """hi there"""
    print "hi"

def goodbye():
    """ciao"""
    print "bye"


>>> import foo, pydoc
>>> pydoc.help(foo)
Help on module foo:

NAME
    foo

FILE
    e:\temp\foo.py

FUNCTIONS
    goodbye()
        ciao
    
    hello()
        hi there

DATA
    __all__ = ['hello']
    __file__ = 'foo.py'
    __name__ = 'foo'


-------

Whereas right now it dumps everything from sys. A 
little proof-of-concept (not quite a patch):

import imp
import foo as _foo # do this programmatically using 
the imp module
if !hasattr(_foo,'__all__'):
    _foo.__all__ = _foo.__dict__.keys()
foo = imp.new_module('foo')

# Get exported attributes
for a in _foo.__all__:
    setattr(foo, a, getattr(_foo, a))

# Get special attributes
for a in _foo.__dict__.keys():
    if len(a) > 4 and a[:2] == '__' and a[-2:] == '__':
        setattr(foo, a, getattr(_foo, a))

import pydoc
pydoc.help(foo)



History
Date User Action Args
2007-08-23 16:02:07adminlinkissue527668 messages
2007-08-23 16:02:07admincreate