Commit 6827294e authored by Raymond Hettinger's avatar Raymond Hettinger

Speed-up search for hidden names by using a set instead of a tuple.

parent 4d076da4
...@@ -168,11 +168,11 @@ def _split_list(s, predicate): ...@@ -168,11 +168,11 @@ def _split_list(s, predicate):
def visiblename(name, all=None): def visiblename(name, all=None):
"""Decide whether to show documentation on a variable.""" """Decide whether to show documentation on a variable."""
# Certain special names are redundant. # Certain special names are redundant.
_hidden_names = ('__builtins__', '__doc__', '__file__', '__path__', if name in {'__builtins__', '__doc__', '__file__', '__path__',
'__module__', '__name__', '__slots__', '__package__', '__module__', '__name__', '__slots__', '__package__',
'__cached__', '__author__', '__credits__', '__date__', '__cached__', '__author__', '__credits__', '__date__',
'__version__') '__version__'}:
if name in _hidden_names: return 0 return 0
# Private names are hidden, but special names are displayed. # Private names are hidden, but special names are displayed.
if name.startswith('__') and name.endswith('__'): return 1 if name.startswith('__') and name.endswith('__'): return 1
if all is not None: if all is not None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment