On Wed, Feb 29, 2012 at 8:19 AM, Barry Warsaw
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
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.
Since this question came up recently, what do you think of adding some more helpers to reprlib to make this even easier to do? I know I just added some utility functions to PulpDist [1] to avoid reinventing that particular wheel for each of my class definitions. Cheers, Nick. [1] http://git.fedorahosted.org/git/?p=pulpdist.git;a=blob;f=src/pulpdist/core/u... Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
participants (2)
-
Nick Coghlan
-
Steven D'Aprano