1 | #!/usr/bin/env python2 |
2 | from __future__ import print_function |
3 | """ |
4 | Simpler test for generator expressions. |
5 | """ |
6 | |
7 | def MakeLookup(p): |
8 | return list(i for i in p) |
9 | |
10 | print(MakeLookup([66])) |
11 | print(MakeLookup([1,2])) |
12 | |
13 | nums = [4, 5, 6] |
14 | |
15 | g1 = (x for x in range(3)) |
16 | g2 = (x for x in [2,3,4]) |
17 | g3 = (x for x in nums) |
18 | |
19 | print(list(g1)) |
20 | print(list(g2)) |
21 | print(list(g3)) |