implemented __iter__

This commit is contained in:
David Halter
2012-08-06 23:21:04 +02:00
parent 9072bd6f52
commit f935d4ff53
3 changed files with 66 additions and 25 deletions

View File

@@ -190,5 +190,5 @@ GetItem("")[1]
#? int() str()
list([1,""])[1]
#? str()
#? int() str()
list(set([1,""]))[1]

View File

@@ -23,15 +23,34 @@ next(gen_ret(1))
next(gen_ret())
# -----------------
# generators should be indexable!???
# generators should not be indexable
# -----------------
def get(self):
def get(param):
yield 1
yield ""
arr = []
for a in arr:
arr += get()
#? []
get()[0]
# -----------------
# __iter__
# -----------------
for a in get():
#? int() str()
a
class Get():
def __iter__(self):
yield 1
yield ""
b = []
for a in Get():
#? int() str()
a
b += [a]
#? list()
b
#? int() str()
arr[0].
b[0]