This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: [python] rename get_value_from_history, maybe others as well
- From: Tom Tromey <tromey at redhat dot com>
- To: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- Cc: Project Archer <archer at sourceware dot org>
- Date: Tue, 25 Nov 2008 18:17:22 -0700
- Subject: Re: [python] rename get_value_from_history, maybe others as well
- References: <m31vwztsjw.fsf@fleche.redhat.com><1227654292.11550.37.camel@localhost.localdomain>
- Reply-to: Tom Tromey <tromey at redhat dot com>
>>>>> "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