This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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] Allow attribute references to gdb.Value objects


On Mon, Aug 15, 2011 at 4:54 PM,  <Paul_Koning@dell.com> wrote:
> Sorry about the top posting, that's about all I can do with the unfortunate mail program I have.
>
> If you want widely used and distributed robust scripts like pretty-printers, yes, indeed. ?On the other hand, I also look at the Python scripting machinery as general purpose scripting to do the sort of things done by armies of users -- exactly as the old scripting stuff was used. ?There you're dealing with stuff that may be much more ad-hoc, limited in life, easily tweaked if it breaks, a user community that might just be one or two people. ?I'm going through that right now -- doing a bunch of scripts to help debug a specific problem. ?That code may in fact not even be used again at all after the bug is found, or if it does get used, keeping it working across gdb releases won't be an issue at all. ?But writing more natural-feeling Python code is a more important consideration.

IMO, the robustness choice outweighs this consideration.  While a lot
of these scripts are for a single-purpose session, I'm finding that we
check them in somewhere and adapt them to future bugs.  I'm sure
they'll break in all sorts of interesting ways; I'd rather not add one
that we *know* will end in breakage.

>
> ? ? ? ?paul
>
> -----Original Message-----
> From: Tom Tromey [mailto:tromey@redhat.com]
> Sent: Monday, August 15, 2011 4:43 PM
> To: Koning, Paul
> Cc: gdb-patches@sourceware.org
> Subject: Re: [Python] Allow attribute references to gdb.Value objects
>
>>>>>> "Paul" == ? <Paul_Koning@Dell.com> writes:
>
> Paul> That's a fair point, but it comes at the expense of making the
> Paul> code look rather un-Pythonic. ?It seems reasonable to offer the
> Paul> option, and document the fact that code that takes advantage of it
> Paul> may be affected by new built-in attributes.
>
> My reasoning is that we want to encourage robust pretty-printers (a main use of the value API), and robust code has to use the dictionary syntax.
> So, why not just enforce this by only having the dictionary syntax?
>
> Tom
>



-- 
Thanks,
Daniel


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