J
Jeff Epler
Anyway, the bytecode that idiom makes is something like:
3 LOAD_FAST 0 (other)
6 GET_ITER
10 STORE_FAST 1 (x)
13 LOAD_FAST 1 (x)
16 YIELD_VALUE
17 JUMP_ABSOLUTE 7
I think that the other thing the compiler must recognize, beyond this
sequence, is that "x" is dead below the loop (no longer used, or stored
to before the next use).
On the other hand, I guess the new YIELD_VALUES opcode could leave the
last value on the top of the stack, replacing this sequence with
LOAD_FAST 0 (other)
GET_ITER
YIELD_VALUES
STORE_FAST 1 (x)
I was imagining that YIELD_VALUES would not put anything on the stack,
if it was used to implement a new 'yield from'/'yield *' statement.
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQFBdmt5Jd01MZaTXX0RAnPIAJ9DC6O9Qc6SyZXKvL2AcGDTkfFdqACfQaiB
tQ8tt5rgc4Fb5ZJ5ZuM1ekE=
=8d2A
-----END PGP SIGNATURE-----