In Python properties are used instead of the Java-style getters, setters. So one rarely sees get... or set.. methods in the public interfaces of classes.
But in cases were a property is not appropriate one might still end up with methods that behave like getters or setters. Now my questions: Should these method names start with get_ / set_? Or is this unpythonic vebosity since it is often obvious what is meant (and one can still use the docstring to clarify non-obvious situations)?
This might be a matter of personal taste, but I would be interested in what the majority thinks about this? What would you prefer as an API user?
Example: Say we have an object representing multiple cities. One might have a method get_city_by_postalcode(postalcode) or one could use the shorter name city_by_postalcode. I tend towards the later.
I've seen it done both ways. Coming from an Objective-C background, I usually do foo()/set_foo() if I can't use a property (although I try to use properties whenever possible). It doesn't really matter that much, though, as long as you're consistent.
(Of course, in your example, I wouldn't call the method get_city_by_postalcode() at all; I'd probably go with translate_postalcode or something similar that uses a better action verb in the name.)
Should I use get_/set_ prefixes in Python method names?