This is the mail archive of the mailing list for the Archer project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.

For example:

Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12) 
>>> foo="abc\1"
>>> 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 []
> Sent: Tuesday, November 10, 2009 10:45 AM
> To: Paul Koning
> Cc: Elmenthaler, Jens;;;
> Subject: Re: [python] Pretty-printers and addressprint
> On Tue, Nov 10, 2009 at 3:53 AM, Paul Koning <>
> wrote:
> >> 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
> inconclusive
> > 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?
> Thanks,
> --
> Paul Pluzhnikov

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]