mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
generators can now be indexed, don't know if this is a good thing. however, it fixes some problems with lists
This commit is contained in:
32
test/completion/generators.py
Normal file
32
test/completion/generators.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# -----------------
|
||||
# yield statement
|
||||
# -----------------
|
||||
|
||||
def gen():
|
||||
yield 1
|
||||
yield ""
|
||||
|
||||
gen_exe = gen()
|
||||
#? ['upper']
|
||||
next(gen_exe).upper
|
||||
#? ['real']
|
||||
next(gen_exe).real
|
||||
#? int() str()
|
||||
next(gen_exe)
|
||||
|
||||
#? int() str() list
|
||||
next(gen_exe, list)
|
||||
|
||||
# -----------------
|
||||
# generators should be indexable?
|
||||
# -----------------
|
||||
def get(self):
|
||||
yield 1
|
||||
yield ""
|
||||
|
||||
arr = []
|
||||
for a in arr:
|
||||
arr += get()
|
||||
|
||||
#? int() str()
|
||||
arr[0].
|
||||
Reference in New Issue
Block a user