[Python-Dev] Re: Rationale behind removing kwdict from keyword.py?

Skip Montanaro skip at pobox.com
Wed Jul 28 06:46:19 CEST 2004


    Bob> This sounds like a bug in pydoc.  If __all__ is defined, help
    Bob> should probably only be given for items in it (public API).

Funny you should mention that:

    revision 1.92
    date: 2004/06/11 04:46:12;  author: montanaro;  state: Exp;  lines: +22 -9
    Respect a module's __all__ attribute.  Closes #969938.

and the corresponding output since then for the keyword module looks like:

    NAME
        keyword - Keywords (from "graminit.c")

    FILE
        /Users/skip/local/lib/python2.4/keyword.py

    MODULE DOCS
        http://www.python.org/doc/current/lib/module-keyword.html

    DESCRIPTION
        This file is automatically generated; please don't muck it up!

        To update the symbols in this file, 'cd' to the top directory of
        the python source tree after building the interpreter and run:

            python Lib/keyword.py

    FUNCTIONS
        iskeyword = __contains__(...)
            x.__contains__(y) <==> y in x.

    DATA
        __all__ = ['iskeyword', 'kwlist']
        kwlist = ['and', 'assert', 'break', 'class', 'continue', 'def', 'del',...

while the output using Python 2.3 is

    NAME
        keyword - Keywords (from "graminit.c")

    FILE
        /Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/keyword.py

    DESCRIPTION
        This file is automatically generated; please don't muck it up!

        To update the symbols in this file, 'cd' to the top directory of
        the python source tree after building the interpreter and run:

            python Lib/keyword.py

    FUNCTIONS
        iskeyword = has_key(...)
            D.has_key(k) -> 1 if D has a key k, else 0

        main()

    DATA
        __all__ = ['iskeyword', 'kwlist']
        keyword = 'yield'
        kwdict = {'and': 1, 'assert': 1, 'break': 1, 'class': 1, 'continue': 1...
        kwlist = ['and', 'assert', 'break', 'class', 'continue', 'def', 'del',...

Skip


More information about the Python-Dev mailing list