1
0
forked from VimPlug/jedi

Get Set comprehensions working.

This commit is contained in:
Dave Halter
2015-12-27 15:37:27 +01:00
parent b479e157fc
commit b3f7d0c29a
3 changed files with 49 additions and 46 deletions

View File

@@ -51,26 +51,6 @@ left
#? int()
[a for a in {1:'x'}][0]
##? 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:
@@ -81,6 +61,9 @@ listen(['' for x in [1]])
#?
([str for x in []])[0]
# with a set literal
#? int()
[a for a in {1, 2, 3}][0]
# -----------------
# nested list comprehensions
@@ -140,17 +123,34 @@ left
right
# -----------------
# set comprehensions
# dict comprehensions
# -----------------
##? str()
{a - 1: b for a, b in {1: 'a', 3: 1.0}.items()}[0]
#?
{a - 1 for a in [1]}
#? int()
{a - 1: 3 for a in [1]}[0]
# -----------------
# set comprehensions
# -----------------
#? set()
{a - 1 for a in [1]}
#? 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()
# -----------------
# name resolution in comprehensions.
# -----------------