thomas lee abkvectorsevencom next problem cropped implementation ast code optimizer related branch elimination elimination code return within functiondef node would ideally like blow away nodes constant false test expression eg def foo false stuff functions cause problems code behave expected however eliminated branch contains yield expression function actually generator function even yield expression never reached def foo false yield 5 addition following also treated generator even though wed like able get rid code following return statement def foo return yield 5 blowing away yield results normal function instead generator want need preserve generator semantics upon revisiting actually made reconsider use const node earlier problem relating arbitrary constants may better annotations could mark functiondef nodes generators ast level force compiler produce code generator eliminate branches anyway alternative think injecting yield node somewhere unreachable ensuring doesnt get optimized away seems pretty hacky comparison ideas cheers tom _______________________________________________ pythondev mailing list zvlllneumpythonorg httpmailpythonorgmailmanlistinfopythondev unsubscribe httpmailpythonorgmailmanoptionspythondevpythondev40tangomucom fri 08 aug 2008 160334 1000 pythondev ast optimization branch elimination generator functions