Python and Literate Programming

jhefferon at my-deja.com jhefferon at my-deja.com
Fri Nov 5 22:19:06 CET 1999


  "Tim Evans" <tre17 at student.canterbury.ac.nz> wrote:
> For just this functionality, you could try using the `noweb' tool.  It
> manages to not break pythons indentation much at all.  For example,
> the input:
>
> <<example outer block>>=
> for p in parrots:
>     <<complain if the parrot p is dead>>
>
> <<check if the parrot p is alive>>=
> if p.perched and not p.nailed:
>     print "It's f****** stuffed it!"
>
> Will actually be correctly turned into:
>
> for p in parrots:
>     if p.perched and not p.nailed:
>         print "It's f****** stuffed it!"
>
> I'm not sure if other tools will do this correctly.  Noweb has the
> disadvantages that it's written in icon, and that its LaTeX output is
> not great, but it isn't all bad.
Noweb works great; that's what I use.  But looking on deja.com on the
comp.lang.programming.literate group for Python also nets a nice program
called py2tex by Jeroen van Maanen <jeroenm at cwi.nl>.  Very nice output.

Jim Hefferon


Sent via Deja.com http://www.deja.com/
Before you buy.




More information about the Python-list mailing list