[Python-ideas] doctest

Barry Warsaw barry at python.org
Tue Feb 28 23:19:18 CET 2012


On Feb 27, 2012, at 05:44 PM, Ian Bicking wrote:

>Doctest needs reliable repr's more than reversable repr's, and you can create
>them using that.  You'll still get a lot of <foobar.Foobar object at
>0x391a9df> strings, which suck... but if you are committed to doctest then
>maybe better to provide good __repr__ methods on your custom objects!

+1 even if you don't use doctests!  I can't tell you how many times adding a
useful repr has vastly improved debugging.  I urge everyone to flesh out your
reprs with a little bit of useful information so you can quickly identify your
instances at a pdb prompt.

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120228/f3f5d8ab/attachment.pgp>


More information about the Python-ideas mailing list