Quick poll: gmean or geometric_mean

Stefan Behnel stefan_ml at behnel.de
Sat Jul 9 06:23:29 EDT 2016


Ethan Furman schrieb am 09.07.2016 um 08:27:
> On 07/08/2016 10:49 PM, Random832 wrote:
>> On Sat, Jul 9, 2016, at 01:26, Steven D'Aprano wrote:
> 
>>> hmean and gmean
>>>
>>> harmonic_mean and geometric_mean
>>
>> The latter, definitely.
> 
> My preference is also for the latter.  However, if the rest of the module
> is filled with abbreviated names you may as well be consistent with them.

+1 for consistency, but I'm just fine with the short names. It's in the
statistics module after all, so the context is very narrow and clear and
people who don't know which to use or what the one does that they find in a
given piece of code will have to read the docs and maybe fresh up their
rusty math memory anyway. Longer names don't help much with that.

If further clarity is needed in a given code context that uses a direct
name import, renaming the function at the same time is easy enough. I often
do that with "os.path.join", for example, which turns into "join_path" on
import. Same problem, easy solution.

Stefan





More information about the Python-list mailing list