[python] rename get_value_from_history, maybe others as well
Tom Tromey
tromey@redhat.com
Wed Nov 26 01:32:00 GMT 2008
>>>>> "Thiago" == Thiago Jung Bauermann <bauerman@br.ibm.com> writes:
Thiago> I've been naming "getters" as get_blah, but I'm not sure if
Thiago> it's useful, and if I should just name them as blah.
I have been thinking this same thing the past few days.
Thiago> So one option would be to make methods which are really
Thiago> attribute getters (Like Frame's get_name, get_pc, get_prev,
Thiago> get_next and others) just an attribute (so you would type "pc
Thiago> = a_frame.pc" instead of "pc = a_frame.get_pc () )
Sounds good.
Thiago> (I didn't look up yet if its possible to define builtins from
Thiago> Python's C binding).
Yeah -- we already do this to implement Parameter.value.
I don't know if it is possible to implement module-scoped things this
way. E.g., can we turn 'gdb.get_current_objfile()' into
'gdb.current_objfile'?
Thiago> Another option would be to keep them as explicit methods, but
Thiago> remove the get_ prefix to make it more concise. Another option
Thiago> would be to keep the get_ prefix.
I think we can consider it case-by-case, with the default being that
argument-less setters should be properties and not methods.
Thiago> Any opinions? Is this just a nit of mine and I should not worry?
I would like us to ship an excellent API, and now is the best time to
fix it.
I've also been thinking that we need an "Inferior" class; then methods
like get_threads and get_objfiles would become methods of this.
Tom
More information about the Archer
mailing list