--- Lib/rlcompleter.py 2014-08-05 15:21:58.000000000 +0100 +++ Lib/rlcompleter.py 2014-08-05 16:58:28.000000000 +0100 @@ -105,7 +105,7 @@ for word, val in nspace.items(): if word[:n] == text and word != "__builtins__": matches.append(self._callable_postfix(val, word)) - return matches + return list(set(matches)) def attr_matches(self, text): """Compute matches when text contains a dot. @@ -130,13 +130,13 @@ return [] # get the content of the object, except __builtins__ - words = dir(thisobject) + words = set(dir(thisobject)) if "__builtins__" in words: words.remove("__builtins__") if hasattr(thisobject, '__class__'): - words.append('__class__') - words.extend(get_class_members(thisobject.__class__)) + words.add('__class__') + words.update(get_class_members(thisobject.__class__)) matches = [] n = len(attr) for word in words: @@ -147,10 +147,10 @@ return matches def get_class_members(klass): - ret = dir(klass) + ret = set(dir(klass)) if hasattr(klass,'__bases__'): for base in klass.__bases__: - ret = ret + get_class_members(base) + ret.update(get_class_members(base)) return ret try: