This is the mail archive of the
mailing list for the Archer project.
[python] rename get_value_from_history, maybe others as well
- From: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Project Archer <archer at sourceware dot org>
- Date: Tue, 25 Nov 2008 21:04:52 -0200
- Subject: [python] rename get_value_from_history, maybe others as well
- References: <email@example.com>
El mar, 25-11-2008 a las 14:16 -0700, Tom Tromey escribiÃ:
> python s = gdb.get_value_from_history(0)
Unrelated to this message, but this has been in the back of my head for
a while: I'm getting tired of typing gdb.get_value_from_history. What
about renaming this to just gdb.history? :-)
I've been naming "getters" as get_blah, but I'm not sure if it's useful,
and if I should just name them as blah. I did this on the grounds that
functions and methods should be named after actions (and thus have
verbs). But perhaps being concise and saving people from carpal tunnel
syndrome is more important. Do you have an opinion?
By the way, I recently learned about Python's property builtin, and how
it is favored instead of using get_blah and set_blah. Property builtins
are a mechanism were a method is invoked every time you try to access
(or set) an attribute in an object.
So one option would be to make methods which are really attribute
getters (Like Frame's get_name, get_pc, get_prev, get_next and others)
just an attribute (so you would type "pc = a_frame.pc" instead of "pc =
a_frame.get_pc () ) and use properties to have them call the native
function which actually get the attribute from GDB guts (I didn't look
up yet if its possible to define builtins from Python's C binding). This
would look more pythonic perhaps, but on the other hand it's artificial
because it's always necessary to call a native function to get something
from the native side, and I don't see much gain from hiding that.
Another option would be to keep them as explicit methods, but remove the
get_ prefix to make it more concise. Another option would be to keep the
Any opinions? Is this just a nit of mine and I should not worry?
Thiago Jung Bauermann
IBM Linux Technology Center