Obj.'s writing self-regeneration script ?

Jerome Alet alet at unice.fr
Fri Jul 8 10:09:40 EDT 2005


Hi,

Le Fri, 08 Jul 2005 15:16:21 +0200, Bas Michielsen a écrit :

> Is there a good/standard way of having (composite)
> objects write a Python script which will regenerate
> the very same object ?

I've done something like this for the ReportLab toolkit.

Last time I checked, this was still part of the project under
the name "pycanvas". You use a pycanvas.Canvas() instance
just like you would use a canvas.Canvas() instance, but you can decide to
regenerate an equivalent Python source program to your original program
when rendering.

The docstring explains how to use it. Also
reportlab/test/test_pdfgen_pycanvas.py shows if it works or not.

NB : this is not generic code, but maybe this can help you.

bye

Jerome Alet



More information about the Python-list mailing list