[wingide-users] Stack Data / Watch should use __repr__
Timothy Reaves
treaves at silverfieldstech.com
Fri Oct 13 08:20:15 MDT 2006
On Oct 12, 2006, at 6:17 PM, Ken Kinder wrote:
> On Thursday 12 October 2006 2:03 pm, Peter Fein wrote:
>> It'd be handy if the Value column of the Stack Data & Watch tools
>> used
>> user-defined __repr__ if available, instead of the builtin-style
>> <mymod.myclass -0x12345678>.
>>
>> While I'm at it, the following should probably be excluded from
>> display by
>> default: __file__, __name__, __builtins__, __doc__, __module__,
>> __weakref__, __dict__. I've added these manually in prefs, but seems
>> sensible.
>
> Hmm, if there are very many objects, calling __repr__ could be
> slow. And since
> that invokes code in your project, it wouldn't be a strictly passive
> debugger...
>
> On the other hand, memory address is just about never useful. Maybe
> you could
> right click and say, "For objects of this type, show this
> attribute." Like
> tell the debugger to show the "name" attribute for "Person"
> objects. Then
> again, that could be weird and complex.
The debuggers I've used, mainly winpdb, use __repr__. Seems to be a
common usage. And it is helpful. Very similar to the way all Java
debuggers use toString(). As far as being passive, well, my
understanding is __repr__ is supposed to do more than toString(), but
still; if that can't be counted on to be bug free, not much could be.
More information about the wingide-users
mailing list