OILS / opy / gold / genexpr_simple.py View on Github | oilshell.org

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