]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Speed-up search for hidden names by using a set instead of a tuple.
authorRaymond Hettinger <python@rcn.com>
Fri, 18 Mar 2011 09:22:15 +0000 (02:22 -0700)
committerRaymond Hettinger <python@rcn.com>
Fri, 18 Mar 2011 09:22:15 +0000 (02:22 -0700)
Lib/pydoc.py

index 9d3cdd5c9b03a81e392b8148dc683a1c7f0a271e..9f8f120c94835a6e6865aa1ada6dc5d71e62f52f 100755 (executable)
@@ -168,11 +168,11 @@ def _split_list(s, predicate):
 def visiblename(name, all=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
     if all is not None: