From 3266aa2d00533753cf039098b53af79fe7de69bb Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Sat, 2 Mar 2013 19:56:12 +0100 Subject: [PATCH] Improve api.Interpreter docstring --- jedi/api.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/jedi/api.py b/jedi/api.py index 4c1af950..2703f6e9 100644 --- a/jedi/api.py +++ b/jedi/api.py @@ -508,10 +508,16 @@ class Interpreter(Script): """ Jedi API for Python REPLs. - >>> from itertools import chain - >>> script = Interpreter('cha', [locals()]) - >>> script.complete() - [] + In addition to completion of simple attribute access, Jedi + supports code completion based on static code analysis. + Jedi can complete attributes of object which is not initialized + yet. + + >>> from os.path import join + >>> namespace = locals() + >>> script = Interpreter('join().up', [namespace]) + >>> print(script.complete()[0].word) + upper """ @@ -529,7 +535,7 @@ class Interpreter(Script): for (variable, obj) in raw_namespace.items(): try: module = obj.__module__ - except: + except AttributeError: continue fakeimport = self._make_fakeimport(variable, module) self._parser.scope.imports.append(fakeimport)