From: "Paul Koning" <Paul_Koning@Dell.com>
To: "Paul Pluzhnikov" <ppluzhnikov@google.com>
Cc: "Elmenthaler, Jens" <jens.elmenthaler@verigy.com>,
<gdb@sourceware.org>, <archer@sourceware.org>,
<dje@google.com>
Subject: RE: [python] Pretty-printers and addressprint
Date: Tue, 10 Nov 2009 18:49:00 -0000 [thread overview]
Message-ID: <D8CEBB6AE9D43848BD2220619A43F3263EB95D@M31.equallogic.com> (raw)
In-Reply-To: <8ac60eac0911100744t5335a44fn7175e2d5c512e450@mail.gmail.com>
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
Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12)
>>> foo="abc\1"
>>> print foo
abc
>>> print repr(foo)
'abc\x01'
>>> print str(foo)
abc
>>>
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
problem...
paul
> -----Original Message-----
> From: Paul Pluzhnikov [mailto:ppluzhnikov@google.com]
> Sent: Tuesday, November 10, 2009 10:45 AM
> To: Paul Koning
> Cc: Elmenthaler, Jens; gdb@sourceware.org; archer@sourceware.org;
> dje@google.com
> Subject: Re: [python] Pretty-printers and addressprint
>
> On Tue, Nov 10, 2009 at 3:53 AM, Paul Koning <Paul_Koning@dell.com>
> 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
next prev parent reply other threads:[~2009-11-10 15:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-10 8:37 Paul Pluzhnikov
2009-11-10 9:24 ` Elmenthaler, Jens
2009-11-10 10:22 ` Paul Pluzhnikov
2009-11-10 11:53 ` Phil Muldoon
2009-11-10 15:06 ` André Pönitz
2009-11-10 15:53 ` Tom Tromey
2009-11-10 15:15 ` Paul Koning
2009-11-10 17:03 ` Paul Pluzhnikov
2009-11-10 18:49 ` Paul Koning [this message]
2009-11-10 18:56 ` Tom Tromey
2009-11-10 19:07 ` Paul Pluzhnikov
2009-11-11 2:06 ` Tom Tromey
2009-11-10 15:45 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D8CEBB6AE9D43848BD2220619A43F3263EB95D@M31.equallogic.com \
--to=paul_koning@dell.com \
--cc=archer@sourceware.org \
--cc=dje@google.com \
--cc=gdb@sourceware.org \
--cc=jens.elmenthaler@verigy.com \
--cc=ppluzhnikov@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox