[Doc-SIG] A promise - using Tools/compiler (yay)

Tony J Ibbs (Tibs) tony@lsl.co.uk
Wed, 29 Nov 2000 12:37:36 -0000

AMK suggested that it would be good to:

> 4) Use Jeremy's Tools/compiler (perhaps including a copy with
> the tool)

and this indeed appears to be exactly what I want. It's not even too
hard to figure out how to use it, given the demo example (the main trick
is to work out how one's supplied visitor class can call "visit" without
defining it, I think). Oh frabjous days.

One minor note - a first attempt at::

	import compiler

under 1.5.2 gives::

  Traceback (innermost last):
    File "docstring.py", line 17, in ?
      import compiler
    File "compiler/__init__.py", line 23, in ?
      from pycodegen import compile
    File "compiler/pycodegen.py", line 12, in ?
      from compiler import pyassem, misc
    File "compiler/pyassem.py", line 138, in ?
      class PyFlowGraph(FlowGraph):
    File "compiler/pyassem.py", line 299, in PyFlowGraph
      _cmp = list(dis.cmp_op)
  AttributeError: cmp_op

but commenting out the line::

	from pycodegen import compile

from __init__.py makes the traceback go away, and since I don't *want*
to work with bytecodes, this may be OK in my context. It is, perhaps,
something that could be "robustified" if it's to be formally supported
under 1.5.2 - but does anyone care?


Tony J Ibbs (Tibs)      http://www.tibsnjoan.co.uk/
"How fleeting are all human passions compared with the massive
continuity of ducks." - Dorothy L. Sayers, "Gaudy Night"
My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.)