mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
tuple/iter are working now
This commit is contained in:
@@ -18,7 +18,8 @@ def iter(collection, sentinel=None):
|
||||
if sentinel:
|
||||
yield collection()
|
||||
else:
|
||||
yield next(collection)
|
||||
for c in collection:
|
||||
yield c
|
||||
|
||||
|
||||
#--------------------------------------------------------
|
||||
@@ -90,6 +91,19 @@ class list():
|
||||
def pop(self):
|
||||
return self.iterable[-1]
|
||||
|
||||
class tuple():
|
||||
def __init__(self, iterable=[]):
|
||||
self.iterable = []
|
||||
for i in iterable:
|
||||
self.iterable += [i]
|
||||
|
||||
def __iter__(self):
|
||||
for i in self.iterable:
|
||||
yield i
|
||||
|
||||
def __getitem__(self, y):
|
||||
return self.iterable[y]
|
||||
|
||||
|
||||
class set():
|
||||
def __init__(self, iterable=[]):
|
||||
|
||||
@@ -193,6 +193,8 @@ list(a)[1]
|
||||
|
||||
#? int() str()
|
||||
list(a)[0]
|
||||
#?
|
||||
set(a)[0]
|
||||
|
||||
#? int() str()
|
||||
list(set(a))[1]
|
||||
@@ -205,5 +207,25 @@ list(set(list(set(a))))[1]
|
||||
##? int() str()
|
||||
list(set(set(a)))[1]
|
||||
|
||||
# frozenset
|
||||
#? int() str()
|
||||
list(frozenset(a))[1]
|
||||
#? int() str()
|
||||
list(set(frozenset(a)))[1]
|
||||
|
||||
# iter
|
||||
#? int() str()
|
||||
list(iter(a))[1]
|
||||
#? int() str()
|
||||
list(iter(list(set(a))))[1]
|
||||
|
||||
# tuple
|
||||
#? int() str()
|
||||
tuple(a)[1]
|
||||
#? int() str()
|
||||
tuple(list(set(a)))[1]
|
||||
|
||||
#? int()
|
||||
tuple({1})[0]
|
||||
#? int()
|
||||
tuple((1,))[0]
|
||||
|
||||
Reference in New Issue
Block a user