This is the mail archive of the
mailing list for the Archer project.
RE: [python] Pretty-printers and addressprint
repr() is a Python builtin function that returns the "representation" of
an object -- a string that matches the representation of that object in
Python. Contrast that with str() which prints it the user-friendly way
which may be less complete.
Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12)
>>> print foo
>>> print repr(foo)
>>> print str(foo)
Note that "repr" puts quotes around the string, and escapes the
non-printable characters. It also escapes quotes, which simply wrapping
a quote around the raw string won't cover.
If in gdb repr() doesn't work as in standard Python that would be a
> -----Original Message-----
> From: Paul Pluzhnikov [mailto:email@example.com]
> Sent: Tuesday, November 10, 2009 10:45 AM
> To: Paul Koning
> Cc: Elmenthaler, Jens; firstname.lastname@example.org; email@example.com;
> Subject: Re: [python] Pretty-printers and addressprint
> On Tue, Nov 10, 2009 at 3:53 AM, Paul Koning <Paul_Koning@dell.com>
> >> Unfortunately I frequently deal with non-ascii strings, and the
> >> problem just wouldn't go away :-(
> > My test (without gdb, I don't have that installed yet) is
> > but I think using repr() will cure that too.
> AFAICT, in GDB repr(value) is a no-op, and the end result of returning
> repr(value) from the pretty-printer is exactly the same as that of
> returning the value itself:
> $4 = 0x4007e0 "this is x\201\202\203\204"
> Should repr(value) do something different?
> Paul Pluzhnikov