Quick poll: gmean or geometric_mean

Marko Rauhamaa marko at pacujo.net
Sun Jul 10 11:03:37 EDT 2016


Ian Kelly <ian.g.kelly at gmail.com>:

> That's still excessive by any reasonable standards. Names should be
> descriptive, but no more verbose than necessary. How about:
>
> force_N = -G * mass1_kg * mass2_kg / distance_m ** 2

Why bother with tagging the names with standard units?

Somewhat related: Many programming frameworks standardize on
milliseconds when expressing durations. Python does the honorable thing
and uses the standard unit, the second, for the purpose. For example,

    coroutine asyncio.wait(futures, *, loop=None, timeout=None,
                           return_when=ALL_COMPLETED)

       [...]

       timeout can be used to control the maximum number of seconds to
       wait before returning. timeout can be an int or float. If timeout
       is not specified or None, there is no limit to the wait time.

   <URL: https://docs.python.org/3/library/asyncio-task.html?highligh
   t=asyncio.wait>


Not only is a universal standard followed but the API is future proof as
it allows for (almost) arbitrary granularity. Want to timeout after 17
femtoseconds? Just specify timeout=17e-15.


Marko



More information about the Python-list mailing list