From: Raymond Hettinger Date: Fri, 25 Mar 2011 21:16:13 +0000 (-0700) Subject: Issue #11666: Teach pydoc to display full help for named tuples X-Git-Tag: v3.3.0a1~2756 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=007bdbd7ab5e69c589112a52960159429af19715;p=python Issue #11666: Teach pydoc to display full help for named tuples --- 007bdbd7ab5e69c589112a52960159429af19715 diff --cc Lib/pydoc.py index 9f8f120c94,dc398e3bea..739b440696 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@@ -165,16 -165,19 +165,19 @@@ def _split_list(s, predicate) no.append(x) return yes, no - def visiblename(name, all=None): + def visiblename(name, all=None, obj=None): """Decide whether to show documentation on a variable.""" # Certain special names are redundant. - _hidden_names = ('__builtins__', '__doc__', '__file__', '__path__', + if name in {'__builtins__', '__doc__', '__file__', '__path__', '__module__', '__name__', '__slots__', '__package__', '__cached__', '__author__', '__credits__', '__date__', - '__version__') - if name in _hidden_names: return 0 + '__version__'}: + return 0 # Private names are hidden, but special names are displayed. if name.startswith('__') and name.endswith('__'): return 1 + # Namedtuples have public fields and methods with a single leading underscore + if name.startswith('_') and hasattr(obj, '_fields'): + return True if all is not None: # only document that which the programmer exported in __all__ return name in all diff --cc Misc/NEWS index f70998c9db,7a73054b5a..f60f79b51c --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -84,27 -49,11 +84,30 @@@ Core and Builtin Library ------- -- Issue #11628: cmp_to_key generated class should use __slots__ +- Issue #6811: Allow importlib to change a code object's co_filename attribute + to match the path to where the source code currently is, not where the code + object originally came from. + +- Issue #8754: Have importlib use the repr of a module name in error messages. + +- Issue #11591: Prevent "import site" from modifying sys.path when python + was started with -S. + +- collections.namedtuple() now adds a _source attribute to the generated + class. This make the source more accessible than the outdated + "verbose" option which prints to stdout but doesn't make the source + string available. + +- Issue #11371: Mark getopt error messages as localizable. Patch by Filip + Gruszczyński. + +- Issue #11333: Add __slots__ to collections ABCs. + +- Issue #11628: cmp_to_key generated class should use __slots__. + - Issue #11666: let help() display named tuple attributes and methods + that start with a leading underscore. + - Issue #5537: Fix time2isoz() and time2netscape() functions of httplib.cookiejar for expiration year greater than 2038 on 32-bit systems.