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


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.

	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


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