mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-10 22:12:24 +08:00
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):
|
||||
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)]
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user