[reportlab-users] Many __repr__() methods are really __str__ methods

Jerome Alet reportlab-users@reportlab.com
Thu, 13 Feb 2003 14:53:33 +0100


On Thu, Feb 13, 2003 at 01:20:51PM -0000, Andy Robinson wrote:
> > >__str(self) methods.   __repr__(self) methods should output a 
> > string that Python
> > >can interpret and these only output strings which a human can 
> > interpret and
> > >Python crashes on their output with syntax errors.
> 
> You are probably right about what we 'should have done'
> but we already did it :-)
> 
> Are you asking for all classes in our framework
> to be perfectly reproducible through a repr-and-eval
> round trip?

You can also use pdfgen.pycanvas.Canvas() instead of
pdfgen.canvas.Canvas() and do an str() on your 
Canvas instance, this generates the equivalent source
code of your original program, but "linearized".

bye

Jerome Alet