Message78291
With lambda, the ban on "return x" in generators can be evaded:
>>> x = lambda: ((yield 1), (yield 2))
>>> list(x())
[1, 2, (None, None)]
>>> dis.dis(x)
1 0 LOAD_CONST 0 (1)
3 YIELD_VALUE
4 LOAD_CONST 1 (2)
7 YIELD_VALUE
8 BUILD_TUPLE 2
11 RETURN_VALUE |
|
Date |
User |
Action |
Args |
2008-12-26 09:57:41 | georg.brandl | set | recipients:
+ georg.brandl |
2008-12-26 09:57:41 | georg.brandl | set | messageid: <1230285461.02.0.901310598804.issue4748@psf.upfronthosting.co.za> |
2008-12-26 09:57:38 | georg.brandl | link | issue4748 messages |
2008-12-26 09:57:38 | georg.brandl | create | |
|