diff --git a/README.rst b/README.rst index 635f192d..97f6f609 100644 --- a/README.rst +++ b/README.rst @@ -97,7 +97,7 @@ You can run Jedi on cPython 2.6, 2.7, 3.2, 3.3 or 3.4, but it should also understand/parse code older than those versions. Tips on how to use Jedi efficiently can be found `here -`_. +`_. API --- diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 31300974..18ca0fc7 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -62,8 +62,8 @@ class Script(object): :type source: str :param line: The line to perform actions on (starting with 1). :type line: int - :param col: The column of the cursor (starting with 0). - :type col: int + :param column: The column of the cursor (starting with 0). + :type column: int :param path: The path of the file in the file system, or ``''`` if it hasn't been saved yet. :type path: str or None diff --git a/jedi/evaluate/__init__.py b/jedi/evaluate/__init__.py index a959d05f..c8dca140 100644 --- a/jedi/evaluate/__init__.py +++ b/jedi/evaluate/__init__.py @@ -242,7 +242,7 @@ class Evaluator(object): except (IndexError, AttributeError): pass else: - if isinstance(comp_for, tree.CompFor): + if isinstance(comp_for, tree.CompFor) and c[0] != '{': return [iterable.Comprehension.from_atom(self, atom)] return [iterable.Array(self, atom)] diff --git a/test/completion/comprehensions.py b/test/completion/comprehensions.py index 98a15bcb..8ba1fbce 100644 --- a/test/completion/comprehensions.py +++ b/test/completion/comprehensions.py @@ -50,6 +50,23 @@ left ##? str() {a-1:b for a,b in {1:'a', 3:1.0}.items()}[0] +# with a set literal +#? int() +[a for a in {1, 2, 3}][0] + +#? set() +{a for a in range(10)} + +##? int() +[x for x in {a for a in range(10)}][0] + +##? int() +{a for a in range(10)}.pop() + +##? int() +iter({a for a in range(10)}).next() + + # list comprehensions should also work in combination with functions def listen(arg): for x in arg: