summaryrefslogtreecommitdiff
path: root/pypers/oxford/gen_with_attr.py
blob: ee1afd59aac75bf35a057a87c10cf1c0870d541b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class MyIter(object):
    def __iter__(self):
        yield 1
        yield 2
        yield 3

it = MyIter()
for i in it: print i

i0 = MyIter()
i1 = iter(i0)
i2 = iter(i1)

print i0 is i1 
print i1 is i2 

it = MyIter()
print it, iter(it)
print iter(it), iter(iter(it))