optimization with the "compiler" module

sean.bowman at acm.org sean.bowman at acm.org
Tue Apr 16 16:53:42 EDT 2002


hello,

I'm wondering if there's a way to optimize code generated using the
compiler module.  for example, if I say::

 import dis
 from parser import compileast, expr
 
 code = compileast(expr('x+3+7.'))
 print dis.dis(code)

I notice that the constants aren't folded.  is there a way to do this, or
do I have to fiddle with the ast myself?

many thanks,
Sean






More information about the Python-list mailing list