brett cannon liivppythonorg wed apr 30 2008 315 thomas lee wrote hi ive working optimization ast including porting old bytecodelevel optimizations ast level questions come process probably appropriate discussion list code im referring found tleeastoptimize branch relevant code pythonoptimizec pythonpeepholec nearly bytecodelevel optimizations moved ast optimizer exceptions waiting ported stuck limbo due fact cant yet inject arbitrary pyobject constants ast examples tuples constants optimization load_globalload_name none load_const none leaves us options 1 new ast expr node constant values types strnum imagine something like constpyobject v effectively translated load_const v compiler trades purity ast little practicality const node real source representation would exist solely purpose injecting pyobject constants ast slight issue people like jython standardizing ast adding burden use 2 allow arbitrary annotations applied ast compiler hints example ast node might optional dict contains set annotation values traversing ast compiler might something along lines exprannotations pyobject constvalue pydict_getitemstringexprannotations constantvalue constvalue addop_oc load_const constvalue consts else visitc expr expr general solution want keep compiler hints track unless somebody think another use case probably overkill possibly ast stuff new knows truly overkill road personally prefer approach 3 keep particular optimizations bytecode level would great able perform optimizations higher level would require effort would mean two passes code two different levels might end case would rather avoid overhead possible question becomes many possible optimizations might come would work reasonably bytecode level forgot option 4 ditching optimizations work bytecode advocating option brett _______________________________________________ pythondev mailing list zvlllneumpythonorg httpmailpythonorgmailmanlistinfopythondev unsubscribe httpmailpythonorgmailmanoptionspythondevpythondev40tangomucom thu 07 aug 2008 220400 0700 pythondev optimization python asts deal constant values