1 | #!/usr/bin/env python2 |
2 | """ |
3 | genexpr_iterable_expr.py |
4 | """ |
5 | from __future__ import print_function |
6 | |
7 | def 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 | |
12 | g = f() |
13 | for x in g: |
14 | print(x) |