forked from VimPlug/jedi
Merge pull request #612 from tjwei/master
fix a set comprehension issue
This commit is contained in:
@@ -242,7 +242,7 @@ class Evaluator(object):
|
|||||||
except (IndexError, AttributeError):
|
except (IndexError, AttributeError):
|
||||||
pass
|
pass
|
||||||
else:
|
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.Comprehension.from_atom(self, atom)]
|
||||||
return [iterable.Array(self, atom)]
|
return [iterable.Array(self, atom)]
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,23 @@ left
|
|||||||
##? str()
|
##? str()
|
||||||
{a-1:b for a,b in {1:'a', 3:1.0}.items()}[0]
|
{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
|
# list comprehensions should also work in combination with functions
|
||||||
def listen(arg):
|
def listen(arg):
|
||||||
for x in arg:
|
for x in arg:
|
||||||
|
|||||||
Reference in New Issue
Block a user