[Python-checkins] r65168 - python/trunk/Lib/rlcompleter.py
facundo.batista
python-checkins at python.org
Mon Jul 21 16:28:17 CEST 2008
Author: facundo.batista
Date: Mon Jul 21 16:28:17 2008
New Revision: 65168
Log:
Issue 3396. Fixed the autocompletion of 'int.', and worked
a little that part of the code, fixing a detail and enhancing
a bit others.
Modified:
python/trunk/Lib/rlcompleter.py
Modified: python/trunk/Lib/rlcompleter.py
==============================================================================
--- python/trunk/Lib/rlcompleter.py (original)
+++ python/trunk/Lib/rlcompleter.py Mon Jul 21 16:28:17 2008
@@ -134,18 +134,23 @@
return []
expr, attr = m.group(1, 3)
try:
- object = eval(expr, self.namespace)
+ thisobject = eval(expr, self.namespace)
except Exception:
return []
- words = dir(object)
- if hasattr(object,'__class__'):
+
+ # get the content of the object, except __builtins__
+ words = dir(thisobject)
+ if "__builtins__" in words:
+ words.remove("__builtins__")
+
+ if hasattr(thisobject, '__class__'):
words.append('__class__')
- words = words + get_class_members(object.__class__)
+ words.extend(get_class_members(thisobject.__class__))
matches = []
n = len(attr)
for word in words:
- if word[:n] == attr and word != "__builtins__":
- val = getattr(object, word)
+ if word[:n] == attr and hasattr(thisobject, word):
+ val = getattr(thisobject, word)
word = self._callable_postfix(val, "%s.%s" % (expr, word))
matches.append(word)
return matches
More information about the Python-checkins
mailing list