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

14 lines, 6 significant
1#!/usr/bin/env python2
2"""
3genexpr_iterable_expr.py
4"""
5from __future__ import print_function
6
7def f():
8 # range is used in THIS scope (the scope of f), not the generator
9 # expression's scope.
10 return (x for x in range(3))
11
12g = f()
13for x in g:
14 print(x)